Learn to pipe in the shell
An exploration of the Linux Shell
Let's practice some common shell piping operations
- Pipe the output of
ls -l /usr/bin | wc -l
to count the files and directories in/usr/bin
- How many did you count?
- Run the following command "echo 'hi'"
- Pipe this to a file by using "echo 'hi' > hello.txt"
- Now run
ls
to verify it exists - count the words in the file
cat hello.txt | wc -w
- How many did you count?