11
Pipes and Redirection
In this chapter, you’re going to learn how to harness one of the most powerful computing concepts in existence: pipes! Pipes can be used to connect commands, building up complex, customized flows that accomplish a specific task. By the end of the chapter, you’ll be able to understand (or compose) something like this:
history | awk '{print $2}' | sort | uniq -c | sort -rn | head -n 10
In case you’re curious, this prints out a top-10 list of your most commonly used shell commands; on my machine, it produces this output:
1000 git
115 ls
102 go
83 gpo (an alias I've set up for pushing a local git branch to the origin)
68 make
65 cd
59 docker
42 vagrant
35 GOOS=linux
30 echo
To really understand pipes, you need to first ...
Get The Software Developer's Guide to Linux now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.