Pipeline Puzzles
The crew list in crew.txt is a mess: names are out of order and some appear more than once. Answer the questions by connecting commands with pipes, then make a clean roster.
How it works: the terminal below is a real Linux machine running in your browser. Click it and
type. Tasks tick themselves off as you complete them; questions are answered in the box under each task.
Press Reset any time for a fresh machine. Your password on this machine (for
sudo) is student.
Hints
Build a pipeline one step at a time: run the first command, look at the output, then add the next |.
Solution explanation
Each answer is a short pipeline. sort crew.txt | uniq gives each name once, in order: count it with wc -l or save it with >. tee writes into a file and still shows the lines on the screen.
Show solution
ls /usr/bin | wc -l
grep -c Jack crew.txt
sort crew.txt | tail -n 1
sort crew.txt | uniq | wc -l
sort crew.txt | uniq > roster.txt
tail -n 3 /etc/passwd | tee last3.txt