Breaking News

How to use a Piping ( | ) in Linux Operating System

Piping ( | ) is an operator that you can use to send the result of a command to another command. This provide a way of writing a super command that will do an amazing stuffs. To use this operator, just read the following examples and you will get a better understanding of it!
I'm using a Kali Linux but don't worry, any version apart from this Kali the command can work.

  • Open your Linux Machine
  • Now Open terminal (This will be used to write a command that will create a directory)



  • I want to use this operator on my Desktop, so I will type the following command to navigate to Desktop.
  • cd /root/Desktop (This will change the current directory to Desktop)
  • On my Desktop, I have a text file called Information, when I open with cat command it displays the following contents.

  • Now, we are going to use a piping operator ( | ). We can use a grep command to search a content of a certain file or directory.
  • From the file called Information we need to search a word 'allow', so we take the output of the first command cat Information and we process it on another command grep (A word to be searched should be followed after a command grep). So we will type the following command.
  • cat Information | grep allow (Output of cat command is sent to grep command, and from output of cat command, grep is searching a word allow)

  • As we can see, we used a piping operator to write an amazing command. This operator can be used to pipe more than one command!!
  • We are done!!! 
Please comment and share with your friends.
Thank you!!

No comments