Pipes

The shell uses a pipe to connect standard output of one command directly to standard input of another command. A pipe (sometimes referred to as a pipeline) has the same effect as redirecting standard output of one command to a file and then using that file as standard input to another command. A pipe does away with separate commands and the intermediate file. The symbol for a pipe is a vertical bar (|). The syntax of a command line using a pipe is

						command_a
						[arguments] | command_b
						[arguments]
					

This command line uses a pipe to generate the same result as the following group of command lines:

						command_a
						[arguments] > temp
						command_b
						[arguments] < temp
						rm temp
					

In the preceding sequence of commands, the first line redirects standard output ...

Get A Practical Guide to Red Hat® Linux® 8 now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.