Skip to main content

Command Palette

Search for a command to run...

Stop Searching, Start Finding: A Beginner’s Guide to the Linux find Command

Published
2 min read

We have all been there. You saved a file three months ago. You know it’s somewhere on your server. You know it has the word "config" in it. But after clicking through twenty different folders, you are ready to give up.

Here is where you put the magical command find.

If the Linux file system is a giant haystack, find is a magnet. It doesn't just look for filenames; it can search by file size, permissions, who owns it, or even the last time you touched it.

If you are starting your journey in CyberSecurity or Linux administration, this is one tool you cannot afford to skip. Here is how to master it.


The find Command follows a simple Structure

find[Where][What]

Where : It means which directory you wanna look.

What : What Criteria am i Looking For?

find /home/user -name "secret.txt"

This Tells Linux to Look inside /home/user and all its sub-folder for a file named secret.txt

The Commands we Use EveryDay

  1. I Forgot Where I Put it
  • You Know the name But not the location

  •     find . -name "notes.txt"
    

    the . means the current directory to search

    • To search in Linux without worrying about capitalization use -iname instead

      • dot(.) searches only the current directory if you wanna search all use /

2)Search By Size

  • Is your server running out of space? You can use find to hunt down massive files clogging up your system.

  •     find . -size +100M
        #find files larger than 100 MB