Mastering Redirection in BASH on Linux
Sending Your Inputs and Outputs Where They Belong
Bash has three standard file descriptors: stdin, stdout and stderr, which refer respectively to input, output and error output. By default, all of these are directed to the terminal, so all input comes from the terminal, and all output (regular and error) will go to the terminal.
You're probably already familiar with redirecting stdin and stdout:
process.pl < datain.txt > dataout.txtTo redirect stderr, you must be more specific:
/etc/init.d/apache2 2> errors.txtOften, you want to redirect both stdout and stderr to the same file, and there are two ways of doing that:
Read the rest of this Linux BASH story at ServerWatch.com
Solid state disks (SSDs) made a splash in consumer technology, and now the technology has its eyes on the enterprise storage market. Download this eBook to see what SSDs can do for your infrastructure and review the pros and cons of this potentially game-changing storage technology.
- 1Linux Top 3: Ubuntu 14.04, Debian Gives Squeeze More Life and Red Hat Goes Atomic
- 2Linux Top 3: CoreOS, Oracle Enterprise Linux 7 and Ubuntu 14.10
- 3Linux Top 3: Debian Dumps SPARC, Ubuntu Takes Over Linux 3.13 and the Core Infrastructure Initiative
- 4Linux Top 3: Fedora, Ubuntu and Gluster Lose Community Leaders
- 5Red Hat Enterprise Linux 7 Finally Hits the Big Time