Loading…
|The pipe (|) sends the output of one command as input to another. This is one of the most powerful features of the terminal!
command1 | command2
The output of command1 becomes the input of command2.
cat file.txt | grep "word" # Read file, then search it
ls | wc -l # List files, then count them
cat data.txt | sort # Read file, then sort lines
A file called fruits.txt contains fruit names, one per line, in random order. Use a pipe to read the file and sort the output alphabetically. The first fruit in the output should be apple.
Loading terminal engine...
This may take a moment on first load