I run the following line from my bash script in order to run the script /usr/run.pl on remote machines

  xargs -P "$numprocs" -I '{}' -n  1 -- perl -e 'alarm shift; exec @ARGV' -- "$timeout" ssh -nxaq -o ConnectTimeout=5 -o StrictHostKeyChecking=no '{}' /usr/run.sh < <(echo -e "$node") 

but I get on the console the following standard output

Connection to closed by remote host.
 xargs: perl: exited with status 255; aborting

where I need to put the 1>/dev/null in my syntax to avoid this message?

  • 2
    Stdio (standard out) is 1 (in this context) stderr is 2. I suspect you want to redirect stderr, meaning 2>/dev/null As to where, I'm not exactly sure what you're doing in that line so I would rather not hazard a guess.
    – Petro
    Jun 29, 2016 at 19:00

2 Answers 2


There are two streams of output from a process that are generally sent to the terminal: standard output (which is bound to file descriptor 1), and standard error (which is bound to file descriptor 2). This allows for easily separated capture of expected output, and error messages or other diagnostic information that is not generally expected to be output.

When you use the redirect (>), that only kicks standard output to the specified file or location, leaving standard error untouched. This allows you to see if there are errors (like those you are seeing).

If you want to send all output, including standard error, you need to redirect both streams:

/path/to/program arg1 arg2 > /dev/null 2>&1

Or, alternatively but more explicitly:

/path/to/program arg1 arg2 > /dev/null 2> /dev/null

The syntax 2>&1 means "Send output currently going to file descriptor 2 to the same place that output going to file descriptor 1 is going to". > is omitting the default of FD1, so it is semantically the same as 1>, which might make 2> make more sense.


If you do not want to show console/terminal logs of bash, use following command for example I start php server which generates request/response logs which I do not want, I do it with this command:

php -S localhost:8989 &> /dev/null

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .