Redirect, Pipe, and Tee

Redirect – ls command creates file called file_list.txt instead of sending to stdout:
$ ls > file_list.txt

Redirect Append – ls command appends file_list.txt instead of sending to stdout:

$ ls >> file_list.txt

Pipe – sends output of ls command to less command:

$ ls | less

Pipes can be stacked:

$ ps aux | grep conky | grep -v grep | awk '{print $2}' | xargs kill

If you pipe to the command ‘tee’, the command output goes to stdout and a file of your choice:

$ ls | tee file_list.txt

This entry was posted in Information and tagged , , , , . Bookmark the permalink.

Leave a Reply