terminal.cab
No.
21
Date
Learning goal
Terminal Start, lesson 10
Level
2 of 3

Command of the day No. 21: grep -r

Purpose: Searches every file in a folder and below.

Syntax: grep -r word folder

Example:

grep -r ERROR logs
logs/app.log:ERROR database timeout
logs/app.log:INFO retry after ERROR ok
logs/app.log:ERROR payment failed
logs/old.log:ERROR disk full

Output from the simulator, as on a real Linux.

Options:

Try it in the terminal Share image

Fills in the command. Nothing runs until you press Enter.

Command of the day No. 21: grep -r. Purpose: Searches every file in a folder and below. Example: grep -r ERROR logs. Remember: With -r, the file name comes first, then the line.
The same card as an image, 1080 x 1350 pixels.

Today's card ยท All cards so far