Saturday, April 6, 2013

Linux interview Questions --- Question 1

Difference between '>' and '|' in linux ?

'>'(redirection) will redirect the output of any command to any file.

eg.

ls -al > list.txt


copies the output of "ls -al" to "list.txt".
Now

'|' (pipe) is used when we want to use output of one command as input to another command.

eg.
ls -al | grep myfile


search my file in the list of files in present directory. Output of "ls -al" used as input to grep command.

No comments:

Post a Comment