

0 / 2 embers
0 / 3000 xp
click for more info
Complete a lesson to start your streak
click for more info
Difficulty: 3
click for more info
Not enough gems
Cost: 6 gems
1: What Is a Filesystem?
incomplete
2: Filepaths
incomplete
3: Parent Directories
incomplete
4: Absolute vs. Relative Paths
incomplete
5: Files
incomplete
6: Tab Completion
incomplete
7: head and tail
incomplete
8: More and Less
incomplete
9: Touch
incomplete
10: Directories
incomplete
11: Move
incomplete
12: Remove
incomplete
13: Copy
incomplete
14: Home
incomplete
15: Grep
incomplete
16: grep Multiple Files
incomplete
17: Find
incomplete
Back
ctrl+,
Next
ctrl+.
This lesson's interactive features are locked, please to keep using them
You might be used to nice graphical interfaces that allow you to search for text in files, usually with Ctrl+F or Cmd+F. But what about when you're working in a terminal?
As it turns out, once you're used to it, searching for text in files in a CLI can be much faster than using a GUI.
The grep command allows you to search for text in files. It has a ton of capability, and we'll only be scratching the surface of its true power.
The most basic use for grep is to search for a string in a file. For example, if we wanted to search for the word "hello" in the file words.txt, we could run:
grep "hello" words.txt
This will print out every line in words.txt that contains the word hello. It's a case-sensitive search, so it will only match hello, not Hello or HELLO.
Applications often write their logs to files on disk. These logs can contain useful information about what the application is doing, and can also be used to debug problems. As a security auditor, you need to dig through these logs to find any evidence of suspicious activity.
Use the grep command to find any lines with the text "CRITICAL" (all caps) in the worldbanc/private/logs/2024-01-10.log file.
Submit the shell checks.