Archive

Posts Tagged ‘redirection’

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
OR
[me@linuxbox ~]$ ls -l /bin/usr &> ls-output.txt

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

Advertisements