Gnuru.org
Productive Linux


Subscribe

 Subscribe via Feedburner in a reader

Enter your email address:

Delivered by FeedBurner


Login
Login:
Password:



Don't have an account?
Sign up to Gnuru.org
Forgot your password?

Bash Command Output Redirection
11 March 2007 @ 19:02 GMT
by Paul

One thing that I can never remember in Bash is redirecting output. This is particularly important if a command, say a test script, is outputting all sorts of information and you need it in a file to examine later.

To redirect STDOUT to a file use '>':

somecommand > file

Of course the normal output is all very well, but usually it is the errors that are more important. To redirect STDERR to a file use 2>

somecommand 2> file

To capture both STDOUT and STDERR use '&>'

somecommand &> file



Comments disabled