Home | Hardware | Internet News |Web Hosting |IT Management |Network Storage
LinuxPlanet
Search 
  Power Search | Tips 

 Front Door
 Discussion
 LinuxEngine
 Opinions
 Reports
 Reviews
 Tutorials
 News
 Technology Jobs

 Browse by subject.
Free Newsletter

Server Daily
More Free Newsletters

Be a Commerce Partner


















internet.com
IT
Developer
Internet News
Small Business
Personal Technology

Search internet.com
Advertise
Corporate Info
Newsletters
Tech Jobs
E-mail Offers

Print this article
Email this article

   LinuxPlanet / Tutorials







Mastering Redirection in BASH on Linux
Sending Your Inputs and Outputs Where They Belong

Juliet Kemp
Tuesday, March 16, 2010 12:21:23 PM

Juliet Kemp
It took me ages to learn bash redirection properly, and I still have to concentrate sometimes to keep my &s and my >s straight. Here's the lowdown in case you, too, have intermittent brain failure on this one.

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.txt
To redirect stderr, you must be more specific:
/etc/init.d/apache2 2> errors.txt
Often, 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





Linux is a trademark of Linus Torvalds.


internet.com home | search | help! | about us

Internet.com
The Network for Technology Professionals

Search:

About Internet.com

Legal Notices, Licensing, Permissions, Privacy Policy.
Advertise | Newsletters | E-mail Offers