Showing posts with label Linux Input and Output Redirections. Show all posts
Showing posts with label Linux Input and Output Redirections. Show all posts

Friday, March 27, 2009

Input and Output Redirection in Linux

Standard Input - 0
Standard Output - 1
Standard Error - 2

> - Output Redirection
< - Input Redirection

# Send an error when file doesn't exist
ls -l myfile.txt 2> test.txt (/bin/ls: adad: No such file or directory)

2>&1 (redirect input and error) into normal file
ls -l xxx.txt 2>&1 another_file