If you need to hide the output without letting the program know it by checking the output/error file descriptor, you can try using the following in a shell:
stty flusho; command ;stty -flusho
or if you just want to hide input from the terminal by the way:
stty -echo; command ;stty echo
See stty(1) manual page for more information.
For Linux, all I know is that Ubuntu 10.04 (Lucid Lynx) and some Debian/Arch Linux (commented below - thanks, hendry) doesn't have the flusho setting (and I can't see anything other appropriate in the man-page). The echo setting works on the Ubuntu anyway.
You can redirect the output of any program so that it won't be seen.
This will redirect the standard output - you'll still see any errors
This will redirect all output, including errors.
There are three I/O devices available on the command line.
To redirect standard output (the default output) to a file (and overwrite the file), use
To append to file.log, use two
>
sTo redirect standard error to the file.log, use
And to append
To combine the outputs into one stream and send them all to one place
This sends 2 (standard error) into 1 (standard output), and sends standard output to file.log
Notice that it's also possible to redirect standard input into a command that expects standard input
For more details, check out the Advanced Bash Scripting Guide.
Hide standard output:
Hide standard and error outputs:
Hide standard output and error outputs and release the terminal (run the command in the background):
If you just want to hide the output (and not save it to a file), you can use:
Edited:
$ command &> /dev/null
For Mac OS X v10.6 (Snow Leopard):
If you need to hide the output without letting the program know it by checking the output/error file descriptor, you can try using the following in a shell:
or if you just want to hide input from the terminal by the way:
See stty(1) manual page for more information.
For Linux, all I know is that Ubuntu 10.04 (Lucid Lynx) and some Debian/Arch Linux (commented below - thanks, hendry) doesn't have the
flusho
setting (and I can't see anything other appropriate in the man-page). Theecho
setting works on the Ubuntu anyway.