• Home
  • Python
    • Introduction to Python
    • Python Developer
  • JavaScript
    • Introduction to JavaScript
    • JavaScript Developer
  • React.js
    • Introduction to React
    • React Developer
  • TypeScript
    • Introduction to TypeScript
    • TypeScript Developer
  • Linux Shell
    • Introduction to the Linux Shell
    • Linux Shell Developer
  • C++
    • Introduction to C++
    • C++ Developer
  • C Language
    • Introduction to C
    • C Developer
  • Rust
    • Introduction to Rust
    • Rust Developer
  • Zig
    • Introduction to Zig
    • Zig Developer
  • Interactive Training
  • Pricing
  • Brainstorm
STEMTrainingGrounds
  • Courses
    • Home
    • Python
      • Introduction to Python
      • Python Developer
    • JavaScript
      • Introduction to JavaScript
      • JavaScript Developer
    • React
      • Introduction to React
      • React Developer
    • TypeScript
      • Introduction to TypeScript
      • TypeScript Developer
    • Linux Shell
      • Introduction to the Linux Shell
      • Linux Shell Developer
    • C++
      • Introduction to C++
      • C++ Developer
    • C Language
      • Introduction to C
      • C Developer
    • Rust
      • Introduction to Rust
      • Rust Developer
    • Zig
      • Introduction to Zig
      • Zig Developer
  • Interactive Training
  • Pricing
  • Navigate
    • Home
    • Reading Grounds
    • Brainstorm

Quick Links

  • About Us
  • Pricing
  • Partnership
  • Brainstorm
  • Terms
  • Privacy
  • Refunds

Courses

  • Python
    • Introduction to Python
    • Python Developer
  • JavaScript
    • Introduction to JavaScript
    • JavaScript Developer
  • React
    • Introduction to React
    • React Developer
  • TypeScript
    • Introduction to TypeScript
    • TypeScript Developer
  • Linux Shell
    • Introduction to the Linux Shell
    • Linux Shell Developer
  • C++
    • Introduction to C++
    • C++ Developer
  • C Language
    • Introduction to C
    • C Developer
  • Rust
    • Introduction to Rust
    • Rust Developer

Newsletter

Subscribe to our free monthly newsletter, for a quick update on Python, JavaScript, and React news

© 2025 - 2026 STEMTrainingGrounds. All Rights Reserved.

Linux Shell Developer -

Lesson 2 of 35

Lesson Progress: 0%

Lesson Progress: 0%
Lesson Incomplete
← Previous: Linux locate command
Lesson 2 of 35
Next: Linux grep command →

The find command searches for files and directories in a directory hierarchy. You give it a starting path and criteria such as name, type, or size, and it finds every matching item. Unlikelocate, find searches the live filesystem and supports powerful filters and actions. Use find when you need fine-grained control over what to search for and what to do with the results.

  • find . -name "*.txt" searches the current directory for files ending in .txt.
  • The dot . means "start in the current directory".
  • The -name option matches filenames using a pattern.
  • Unlike locate, find searches live and does not use a database.
  • find /home -name "*.md" searches the /homedirectory for Markdown files.
  • You can specify any directory path as the starting point.
  • Using an absolute path lets you search anywhere on the system.
  • The -name pattern *.md matches all files ending in .md.
  • find . -type d finds only directories, not regular files.
  • The -type d filter restricts results to directories.
  • You can also use -type f to find only regular files.
  • Filtering by type is useful when you want to explore a folder structure.
  • find . -size +1M finds files larger than 1 megabyte.
  • The + prefix means "greater than".
  • You can use suffixes like k, M, andG for kilobytes, megabytes, and gigabytes.
  • Size filters help you find large files that might be using up disk space.
  • find . -empty finds empty files and directories.
  • An empty file has a size of zero bytes.
  • This is useful for cleaning up placeholder or log files that contain no data.
  • The -empty flag matches both empty regular files and empty directories.
  • find . -name "*.txt" -exec rm \; finds all.txt files and deletes them.
  • The -exec option runs a command on every matching file.
  • The is a placeholder that represents each found file.
  • The \; marks the end of the -exec command.

Test Incomplete

What does find . -name "*.txt" do?

Question #

1/15

Score

0/0 - 0.0 %

Task Incomplete
Example
~$ find . -name "*.txt"
  • Run find . -name "*.txt"
Linux Shell
~$
Task Incomplete
Example
~$ find /home -name "*.md"
  • Run find /home -name "*.md"
Linux Shell
~$
Task Incomplete
Example
~$ find . -type d
  • Run find . -type d
Linux Shell
~$
Task Incomplete
Example
~$ find . -size +1M
  • Run find . -size +1M
Linux Shell
~$
Task Incomplete
Example
~$ find . -empty
  • Run find . -empty
Linux Shell
~$
Task Incomplete
Example
~$ find . -name "*.txt" -exec rm {} \;
  • Run find . -name "*.txt" -exec rm {} \\;
Linux Shell
~$