Linux Ask!

Linux Ask! is a Q & A web site specific for Linux related questions. Questions are collected, answered and audited by experienced Linux users.

Jan 072008

How to use pipe in Linux


Pipe | is very useful when you want to redirect the output of a program as an input of another program.

The combinations of using pipe in Linux is almost unlimited.

Some common usage:

1. count the number of lines in a file

cat test.txt | wc -l

2. read a very large text file

cat large.txt | less

3. filter filename from find util

find -type f | grep foo.txt

 Leave a Reply



You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>