A shell is software that lets users interact with the operating system, usually by typing at a command-line.

learn more… | top users | synonyms

-1
votes
1answer
40 views

Can't understand loops :( [on hold]

I'm trying to understand better the while and until loops, can someone help me with this example? #!/bin/bash # Listing the planets. for planet in Mercury Venus Earth Mars Jupiter Saturn Uranus ...
2
votes
1answer
47 views

What is the difference between “elif” and “else if” in shell scripting?

I am very new to shell scripting. When I look at some code, written for ksh (#!/bin/ksh) I see there is else if as well as elif used in one script. So, what is the difference between else if and ...
0
votes
2answers
30 views

Alter output of every command

I'd like to know if there's any way of altering output of every command I execute in terminal. The purpose is to make the output formated for my markdown howto's. E.g. ls -la .*z #>-rw-r--r-- 1 ...
1
vote
1answer
23 views

echo “something” > file not working when sh script is being executed by remote PHP server

I've got a web-server with my hardcoded webpanel for Source server management and I've got my VPS on CentOS which doesn't really want to execute sh script when asked from remote server. Web-server ...
1
vote
1answer
23 views

Good way to bookmark/navigate relative directory paths?

I work on a linux system with bash 4.x where I frequently find myself navigating different copies of very deep (and large) file directory structures. However, in reality I only need to access a ...
1
vote
2answers
181 views

Why is “source <(cmd)” working but not “$(cmd)”

I want to have a script to call with params which adds some aliases to my current shell. The aliases have to be builded in respect to the calling parameters and the current directory from where I ...
1
vote
1answer
20 views

Split very long line of words into separate lines of max length

I have a script that outputs a list of packages on a single long line separated by spaces. The information included in this line shall be inserted into a text file which is later presented to a user. ...
2
votes
1answer
36 views

Percent sign (%) in front of shell command

I just pasted a bunch of code into my shell, but forgot to remove the leading % before running the command. It appears to have done nothing. Why does this do nothing in my shell (zsh)? > % echo ...
0
votes
1answer
28 views

Linux find files in subdirectories by extension (.txz) then move them to specified directory using regular expressions

I have mirrored a directory from a server with a large number of sub directories, each of which contain a .txz package and the usual .txt and descriptor files. What I would like to do is the ...
64
votes
2answers
7k views

Is “ps -u” Really a Bad Syntax?

IMHO ps -u shows a very useful output, much better than ps -u $USER: $ ps -u Warning: bad syntax, perhaps a bogus '-'? See /usr/share/doc/procps-3.2.8/FAQ USER PID %CPU %MEM VSZ RSS TTY ...
0
votes
0answers
40 views

36 forks of a program Vs. 36 instances of it? Pros and cons? [on hold]

For a research project in human learning and cognition we're writing a wrapper shell script with these objectives: Should launch 36 different PDFs at once. Place them appropriately at different ...
0
votes
1answer
21 views

output of sudo -l confusing me

(habdbsync) NOPASSWD: ALL, (habdbsync) !/bin/sh, !/bin/ksh, !/bin/csh, !/bin/tcsh, !/bin/zsh, !/bin/bash, (habdbsync) !/bin/su, (habdbsync) !/usr/bin/ssh, !/usr/bin/scp, !/usr/bin/slogin (root) ...
0
votes
0answers
39 views

How to justify and center text in bash?

Newbie here. I'm looking for bash script to center and justify text. My script only works with one line of text. How would you improve it? #!/bin/bash COLS=$(tput cols) while true; do clear ...
2
votes
2answers
174 views

How to take control back on a separate process in Linux shell?

I just set up a Minecraft server on my VPS for my brother and I ran it with a bash script : sh ./server.sh& This way, the server is running and I can still work on the same command line with ...
1
vote
0answers
19 views

UEFI shell mode with no colon key

I have a newly built PC with a UEFI-enabled motherboard and I'm having trouble getting my DVD drive to boot into UEFI mode so I opted to boot into UEFI Shell to manually start the DVD in UEFI mode. ...
1
vote
0answers
51 views

Unexpected Bash glob completion uses first match even if ambiguous

If I have the following files in a directory: $ ls a-file-1 b-file-2 something-else And I type $ cat *file*<TAB> The line unexpectedly updates to $ cat a-file-1 | (pipe denotes cursor) ...
0
votes
0answers
15 views

How can I open a file with its associated default application from a networked drive via Shell on Windows?

I have a file Z:\test.txt. I can do "notepad z:\test.txt". But "start z:\test.txt" or just "z:\test.txt" gives me "Access denied". I have full read/write access to the share. How can I fix or work ...
2
votes
2answers
26 views

Grep in newest file

I'm trying to find a specific line from the newest file I have in subfolders. Files have the same name. So structure is like: Folder SubFolder1 filename.xml SubFolder2 filename.xml I'm ...
0
votes
2answers
42 views

FileZilla: Can I run a remote shell command via FileZilla client?

I have a very simple question. Can I run a remote shell command on the server via FileZilla client. For instance can I do a: tar -zxvf myarchive.tar.gz etc... (didn't think it was possible with ...
0
votes
0answers
37 views

Shell Script automatically exits from SSH section after switching of user (through pbrun command)

I have the below piece of code.. ssh some_user@server << EOF echo 'Successfully connected to the server' pbrun previlige -u user ls pwd id ...few more commands EOF if [ $? -eq 0 ] then echo ...
0
votes
1answer
23 views

What does ${file?my.file.txt} and ${file:?my.file.txt} mean in Bash?

When I read some tutorial today, I came over with the statements like ${file?my.file.txt} and ${file:?my.file.txt}, what do ${file?my.file.txt} and ${file:?my.file.txt} mean in Bash script?
-1
votes
1answer
34 views

What is the difference between set, env, declare and export when setting a variable in Linux shell?

What is the difference between set, env, declare and export when setting a variable in Linux shell, like Bash?
0
votes
0answers
28 views

Why variables in shell are not inherited by sub-shell now that the sub-shell is implemented by fork?

When running shell command in shell scripts, a sub shell process is generated. Doesn't the process is generated by fork function? Why the variables that are not exported are not inherited? In fork, ...
-1
votes
0answers
8 views

automating synchronized activities in 2 programs with a script

I've never posted here and don't know much at all about Windows programming. I am in an experimental lab where we have a computer running 2 software applications (1) Andor Solis - controls an EM-CCD ...
1
vote
2answers
34 views

Bash parameter Expansion: Best practices for speed?

I was just wondering if anybody knows any best practices or if there is any documentation about this topic: The scenario is searching / grepping in the log files. To make my point I will use ls. So ...
0
votes
3answers
31 views

Linux hosting with web-based shell access

I am looking for a service that gives user some computing resources, a Linux OS and a preferably web browser based shell access. Are there any services that you can recommend? The bandwidth usage ...
0
votes
1answer
8 views

How do I recover from a `tmux a` by mistake within a tmux session?

I have a tmux session with a pair of windows. I want to recover the stdout from both those windows. I found this example, and so, within my existing attached session, ran tmux a. I now have a screen ...
0
votes
1answer
17 views

List folders by modification time of children in linux?

I have a folder, we'll call it /scripts/, that contains subfolders for a number of different scripts (let's say /scripts/file_export, /scripts/record_ingest, /scripts/stats). Inside these folders are ...
2
votes
1answer
22 views

Change puTTy presets via registry

I am fixing presets through the .reg file instead of in puTTy because I am going to make this an open source registry. Mostly changing themes, and my school doesn't know what the hell they are doing ...
2
votes
1answer
16 views

Pipe standard error to file and keep it on standard error?

I have a script (fragment) for which I'm logging output and standard error: #!/bin/sh #... { date "+%Y-%m-%d %T" cd $workdir ls -ltr validfile badfile #example command that provides stdout, ...
0
votes
0answers
4 views

detox not removing all whitespace

Here's a process that is giving me some trouble. Hope you can help: I unzip a file generated by system X. All files have white spaces interspersed in the file name. I use detox to remove the white ...
1
vote
1answer
39 views

Bash - list files within date range

So far I've been basing my efforts around this blog and have come up with: startdate=”201407010000? enddate=”201408010000? touch -t $startdate ./startdatefiles touch -t $enddate ./enddatefiles find ...
0
votes
0answers
21 views

Batch arguments for SSH Secure Shell in Windows 7?

I installed SSH Secure Shell to connect to my remote server, and I want to automate the process of updating my website. I was going to make a batch script to automatically push and pull from my site ...
1
vote
0answers
28 views

How can I efficiently filter Dos packets? [duplicate]

I have recently been the victim of some Dos attacks. The facts : I received a very high amount of packets saturating my connection and preventing me from accessing the Internet during one hour ...
0
votes
2answers
27 views

How to make a copy of file in the same directory

This creates a file in the same directy as 'some.file.bak'. find /home/ -ipath "*/temp/some.file" -type f -exec cp {} {}.bak \; How to make a copy in another name such as 'another.file' in the ...
0
votes
1answer
15 views

Relative Path in Chain of Process Call

I have a Java program which executes a bunch of python and shell scripts, which in turn will call some other python/shell scripts. If I use relative paths in any of the scripts, would the paths be ...
0
votes
0answers
14 views

How to run pip in non-interactive mode?

Most of tools I'm using have some mode (often ON by default) where they ask me zero questions while running the command. apt-get is an example close to pip. There's -y option which makes it ...
0
votes
1answer
12 views

Bash expansion to list from a directory

I tend to work on multiple projects, all stored inside my home (~) directory inside a directory called web. At one point all my projects were inside a single directory inside this; so to move from ...
2
votes
1answer
59 views

How to diff the redirection of two commands in a shell script

in the command line I can diff the output of two commands with $ diff <(cmd1) <(cmd2) but if I put this in a shell script $ sh do_two_comands_diff.sh It does not work $ diff <(ls) ...
0
votes
2answers
50 views

virtualbox increase cpu cores script wise

1x cpu core is not enough for an SMB filesharing Ubuntu box. How do we poweroff the VM at midnight, increase the cpu cores 1->2, and power on that box (script-wise)? (it's a windows host... but ...
2
votes
1answer
26 views

Easily print out a spaces between larger data outputs in bash

I'm grepping through a very large web directory, and when I do multiple greps in a row, when scrolling up, it is difficult to tell when one result ends and an other one starts. I tried just clear, ...
0
votes
1answer
76 views

How to run an infinite loop program on startup on a raspberry pi without halting boot up

I have a shell script: #!/bin/bash while sudo /home/pi/MyCode; do :; done echo Error with MyCode which runs a program in an infinite loop. I want to set up the shell script to run at start-up ...
0
votes
1answer
27 views

How to use the awk to print the output

This command nstats gives me output like below. How can I use awk or grep to give me the uptime with only days on it? I cannot use the "" to get the output. HOSTNAME LOAD MEMORY SWAP PROCS ...
0
votes
4answers
18 views

How do I close stdin in a shell script?

I have a misbehaving program that I need to call from my script. It exits as soon as it sees something on stdin. Is there a way to close stdin?
0
votes
1answer
19 views

what's the way to explicitly provide memory to shell script?

How can I give a shell script specific amount of memory to run? If I run a java program I can use -Xmx. But what if it is a shell script?
0
votes
3answers
37 views

Moving folders in Linux inconsistency

I have a shell script that deploy an application to a staging server. However, one of the application's directory needs to be backed up and restored after the deployment (so it is not overwritten). I ...
0
votes
2answers
122 views

Shell script to SFTP file to remote server

This is probably a question asked before, but I can't find a good question/answer. I need to write a shell script that will be called by PHP program (exec function) to move all *.pdf files to a remote ...
0
votes
3answers
49 views

Why is this echo command not working?

I want to overwrite /etc/postfix/master.cf with my own content. I'm using echo "<content>" > /etc/postfix/master.cf to try and accomplish this. But when I do: echo "# # Postfix master ...
0
votes
2answers
65 views

How to execute multiple multiline mysql queries with a shell script?

I want to run multiple MySQL queries from a shell script. I'm using the following code: mysql -u <redacted> -p<redacted> servermail << EOF CREATE TABLE `virtual_domains` ( `id` ...
0
votes
2answers
23 views

followup: why are shebang files not suid-able?

followup question to http://unix.stackexchange.com/questions/364/allow-setuid-on-shell-scripts . there is a very good answer by Gilles. alas, I do not understand it. nothing described there seems ...