How to hide the screen output (printf) of a shell application in Linux?
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 IO devices available on the commandline.
To redirect standard out (the default output) to a file (and overwrite the file), use
To append to file.log, use 2 >s
to 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 (stderr) into 1 (stdout), and sends stdout to file.log
Notice that it's also possible to redirect standard in into a command that expects stdin
If you just want to hide the output (and not save it to a file), you can use:
$ command &> /dev/null
For Mac OS X (10.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 Ubunutu (10.04 "Lucid") and some "Debian/Arch" (commented below - tnx hendry) doesn't have the
Hide standard output
Hide standard and error outputs
Hide standard and error outputs and release terminal (run the command in background)