Piping in Linux Operating System
Piping is the process of sending the output of one command to the input of another command. We use the pipe operator | to pipe the commands in Linux. Let’s see an example below of piping two commands in Linux.
ps command allows us to list the processes running in the Linux box. We can use ps -aef command to output all the processes running on the command.
$> ps -aef
to know more about ps command, we can use
$> man ps
However, let’s say we are interested in only the processes that run firefox we can pipe the ps output to a search command like grep . grep command is used to search for keywords. It searches for the pattern specified. There are several variations of this command like grep,fgrep, etc. To know more or learn about the commands, type the below command
$> man grep
To use the pipe command, redirect the output of the ps command to the grep command as shown below:
$> ps -aef | grep firefox