$ CLI Academy

Viewing Content

Search & Pipes

Filter output and chain commands together.

grep searches text: grep "error" app.log.

The pipe | sends one command's output into the next:

ls -la | grep ".txt" lists only lines containing .txt.

Combine with wc -l to count lines: grep "TODO" *.md | wc -l.

$ Commands to try

$ grep "practice" notes.txt
$ ls | grep .txt
$ cat notes.txt | wc -l
$ history | grep cd

Practice exercise

List files in your practice folder and pipe to grep to find only .txt files.