$title = "Connecting commands together"; $area = "Unix Support"; $metadata = "unix, commands, connecting, join, joining, pipe"; $pfloc = ""; require '/usr/local/wwwdocs/ucs/fragments/header.phtml'; require '/usr/local/wwwdocs/ucs/fragments/header-bc.phtml'; ?>
Unix allows you to link two or more commands together using a pipe. The pipe takes the standard output from one command and uses it as the standard input to another command.
command1 | command2 | command3
The | (vertical bar) character is used to represent the pipeline connecting the commands.
With practice you can use pipes to create complex commands by combining several simpler commands together.
To pipe the output from one command into another command:
who | wc -l 342
This command tells you how many users are currently logged in on the system: a lot!
The standard output from the who command - a list of all the users currently logged in on the system - is piped into the wc command as its standard input. Used with the -l option this command counts the numbers of lines in the standard input and displays the result on the standard output.
require '/usr/local/wwwdocs/ucs/fragments/footer.phtml'; ?>