Академический Документы
Профессиональный Документы
Культура Документы
Redirecting
Pipes
Other
Standard Streams
Redirecting
Pipes
Other
Standard Streams
Redirecting
Pipes
Other
Standard Streams
Redirecting
Pipes
Other
Combining stdin and stdout Can use redirects together (order not important)
cat < infile.txt > outfile.txt or cat > outfile.txt < infile.txt
Standard Streams
Redirecting
Pipes
Other
Standard Streams
Redirecting
Pipes
Other
Pipes
Pipes allow the standard output of one program to be used as the standard input of another program. The pipe operator, written as |, takes the output from a command on its left and feeds it as standard input to the command on the right of the pipe.
ls | sort -r ls -l | cut -c 38-80 cat file.txt | more
Standard Streams
Redirecting
Pipes
Other
Advance Pipes
du -sc * | sort -n | tail the du command is for disk usage (default is in blocks of 512 bytes). The s and c ags are to summerize and give a grand total respectively The sort -n command will sort by numeric value head and tail commands print out a few lines at the head or tail of the le respectively
Standard Streams
Redirecting
Pipes
Other
Standard Streams
Redirecting
Pipes
Other
Separating commands
Suppose you need to continue a command to the next line, use the \ to do so and then continue your command on the next line
cat filename | sort \ | wc Usually seen in shell scripts