7 July, 2009

Pipe commands on the Linux command line



One of the most powerful features in a linux based operating system is the command line. Knowing how to use the command line in a linux distribution although not absolutely needed can save a lot of time and allow you to accomplish some amazing things that would take ages in a GUI assuming that you could accomplish them at all.

One of the main aspects of the linux command line that gives it so much power and potential is the pipe functionality. The pipe functionality is accessed by using the special symbol |

So what is the pipe functionality, well basically using a pipe allows you to put the output of one command into the input of another. So for example you can get a list the files in a directory using ls, and then you can pipe the output into another application, for example grep.

So an example of using the pipe command is below:

ls | grep contains

It is also possible to use more than a single pipe in any given command, an example of using more than one pipe is below:

cat file1.txt | grep rabbit | grep frog

The above command would show all lines in the file1.txt that contains the word rabit and frog.

Well that is a basic guide to how pipe commands work.

------------------------------------------
NOTE: These articles are tutorials/general ramblings. I do not except responsibility for anything that goes wrong, be it a broken HDD, an entire computer or if you chop off your arms, follow anything I say on this site at your own risk.
------------------------------------------

Comments



Leave a comment

Name:


URL:(optional)


Protection Number (Please insert in box below):5495


Comment:


This website was designed and implemented by myself, all opinions and views expressed are my own unless otherwise specified. Excluding the images contained within the header and any specified elsewhere on the site images are my own.

Copyright Rob Ward
2009 - 2012