
Linux Shell Scripting Essentials
By :

The outputs of the programs are generally saved in files for further use. Sometimes, temporary files are created in order to use an output of a program as an input to another program. We can avoid creating temporary files and feed the output of a program as an input to another program using bash pipe and pipelines.
The pipe denoted by the operator |
connects the standard output of a process in the left to the standard input in the right process by inter process communication mechanism. In other words, the |
(pipe) connects commands by providing the output of a command as the input to another command.
Consider the following example:
$ cat /proc/cpuinfo | less
Here, the cat
command, instead of displaying the content of the /proc/cpuinfo
file on stdout
, passes its output as an input to the less
command. The less
command takes the input from cat
and displays on the stdout
per page.
Another example using pipe is as follows:
$ ps -aux | wc -l # Showing...
Change the font size
Change margin width
Change background colour