CHAPTER 3 · 5 lessons · 65 exercises
Search
Search by name, and search by the text inside. The tools that save you opening things one by one.
Once the files pile up, looking with your eyes is the slowest thing you can do.
There are only two tools in this chapter. find searches by name or kind, grep searches by the text inside. Learn those two and "I cannot remember where I wrote that setting" turns into a single line.
grep brings a way of writing called a regular expression along with it — that notation where ^ is the start of a line and $ is the end, which looks like a pile of symbols at first. But you only ever use a handful of them, and they make your searching far finer.
Last comes which and --help, so that you can look up where a command lives and how to use it yourself. Once you can do that, meeting a command you do not know no longer means asking someone else.
This environment does have man (the manual) in it, but not a single page of content, so --help is how you look things up here. Remember that man works on a real computer.
Lessons in this chapter
Search by name and by content
- 08Track it down by nameUse find to track down a file by name when you have no idea where it is.Go to the exercises
- 09Narrow it down by kind and sizeUse -type and -size on find to get only the files, or only the big ones.Go to the exercises
- 10Search by the words insideUse grep to find words written inside a file, and change the sieve with -i and -v.Go to the exercises
- 11Search by shape (regular expressions)Use ^ $ . [] * and the + ? | of -E to search for a shape rather than a word.Go to the exercises
Look it up yourself
- 12Looking up the tools themselvesUse which, type and --help to find out where a command lives and how to use it.Go to the exercises