Posts Tagged ‘standard’

Linux Command-line : Some useful Redirection techniques

Redirecting Standard Output
[me@linuxbox ~]$ ls -l /usr/bin > ls-output.txt

Append redirected output to a file instead of overwriting the file from the beginning
[me@linuxbox ~]$ ls -l /usr/bin >> ls-output.txt

Redirecting Standard Error
[me@linuxbox ~]$ ls -l /bin/usr 2> ls-error.txt

Redirecting Standard Output And Standard Error To One File
[me@linuxbox ~]$ ls -l /bin/usr > ls-output.txt 2>&1
[me@linuxbox ~]$ ls -l /bin/usr &> ls-output.txt

Disposing Of Unwanted Output
[me@linuxbox ~]$ ls -l /bin/usr 2> /dev/null