Skip to content
Learn Netverks

Lesson

Step 16/36 44% through track

find-grep-bash

find and grep

Last reviewed May 28, 2026 Content v20260528
Track mode
none
Means
Read / quiz
Reading
~1 min
Level
intermediate

This lesson

This lesson teaches find and grep: the syntax, patterns, and safety habits you need before advancing in Bash.

Teams still ship find and grep in Bash codebases—skipping it leaves gaps in debugging and code reviews.

You will apply find and grep in contexts like: Log analysis, one-off data transforms, and ad hoc file searches on servers.

Read each lesson, copy bash examples into your own terminal, and complete the lesson MCQs—there is no in-browser runner for security reasons.

When you can explain the previous lesson's ideas without copying starter code.

find walks directory trees; grep searches text. Together they answer “where is this file?” and “which files mention this string?”

find basics

find . -maxdepth 2 -type f -name "*.txt"
find . -type f -mtime -7   # modified in last 7 days

Always start with a narrow path (. or project root) before searching /.

grep recursion

grep -R "TODO" src/
grep -n "error" log.txt
grep -i "warning" log.txt

-n shows line numbers; -i ignores case—common in code review prep.

Exclude noise

grep -R --exclude-dir=.git "function" .

Skip .git and node_modules to keep searches fast—pair with Git knowledge.

Important interview questions and answers

  1. Q: find -name pattern?
    A: Shell globs like *.txt—quote them so the shell does not expand early.
  2. Q: grep -R risk?
    A: Can search huge trees—scope paths and exclude vendor dirs.

Self-check

  1. What find flag limits depth?
  2. What grep flag prints line numbers?

Tip: Add --exclude-dir=.git to grep—learn why in Git.

Interview prep

find -name?

Filter files by glob pattern.

grep -R?

Recursive search in directory trees.

Interview tip Lesson completion confidence

Can you explain this lesson in 30 seconds without reading notes?

Not saved yet.

Check yourself

Multiple choice — immediate feedback.

Discussion

Past discussion is visible to everyone. Only logged-in users can post comments and replies.

Starter discussion topics

  • grep -r pitfall?
  • find -name case?

Sign up or log in to post comments and sync lesson progress across devices.

No discussion yet. Be the first to ask a question.

Jump