LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - General
User Name
Password
Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.

Notices


Reply
  Search this Thread
Old 05-03-2008, 09:06 PM   #1
jezz
LQ Newbie
 
Registered: May 2008
Posts: 1

Rep: Reputation: 0
piping |


Can some one please give me an example of how it works as well as a description thank you
 
Old 05-03-2008, 09:10 PM   #2
btmiller
Senior Member
 
Registered: May 2004
Location: In the DC 'burbs
Distribution: Arch, Scientific Linux, Debian, Ubuntu
Posts: 4,290

Rep: Reputation: 378Reputation: 378Reputation: 378Reputation: 378
Piping is simply the act of passing the standard output (usually printed in the terminal) of one program as standard input to another program, e.g.:

Code:
ls -l | less
pipes the output of ls -l to less so you can scroll through it, e.g. when listing a directory with lots of files.

Another example:

Code:
echo "The cat climbed the tree" | sed -e 's/cat/dog/'
prints "The dog climbed the tree" since the echo output is passed as input to sed.
 
Old 05-04-2008, 04:28 AM   #3
konsolebox
Senior Member
 
Registered: Oct 2005
Distribution: Gentoo, Slackware, LFS
Posts: 2,248
Blog Entries: 8

Rep: Reputation: 235Reputation: 235Reputation: 235
a pipe is actually treated the same as a file but is always accessed by two processes and is a stream of memory (perhaps virtually) that loops itself to the beginning after reaching data to the end.. going back and forth for every read and write.

the write pointer always goes ahead before the read pointer..
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Piping ls Kcghost Linux - General 9 03-05-2008 07:24 PM
Piping... disruptive Programming 3 02-12-2008 01:09 PM
Help with piping mijohnst Linux - General 7 10-21-2005 04:14 PM
piping /forking geminigal Programming 3 04-10-2005 09:49 PM
Piping question OtisLinux Linux - Software 1 02-12-2004 01:38 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - General

All times are GMT -5. The time now is 04:33 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration