Lessons
08Find anything
0 of 7 tasks

Lesson 08 · about 14 min · 7 tasks

Find anything

Search inside files with grep, and find files by name with find.

step 1 of 6

Search inside a file

grep prints every line in a file that contains what you’re looking for. Give it the word, then the file:

$ grep WARN logs/app.log
WARN  slow response from /search
WARN  disk 80% full

Most terminals highlight the matching part. grep is case-sensitive, so warn and WARN are different searches.

Your turn, in the terminal

  • Find every line containing ERROR in logs/app.log
mapfolders appear as you explore
/ …
home/ …
you/◂ you are here
nowFind every line containing ERROR in logs/app.log
terminal
Practice terminal. Nothing you do here touches your real computer.
Type help to see what it understands.
you@terminal-mastery:~$