How to search for files on the command line in Linux

H

How Can We Help?

  • By using the find command we can search for files and directories using the command line. The find command uses a raw search to find files and directories.
  • The usage is find [PATH] [OPTIONS][SEARCH CRITERIA]

    Example:

    find /home/ -name test

    The example above finds all files/directories within the home directory that contain the word test

  • Below are different common options that can be used together with the find command namely:
    • -name = Find files with the specified name (see example above)
    • -user = Finds files owned by the specified user
    • -size = Finds files larger than the size specified
    • -mtime n = File’s data was last modified n*24 hours ago.
  • To read more about the find command use the man command
    man find

About the author

Ian Carnaghan

I am a software developer and online educator who likes to keep up with all the latest in technology. I also manage cloud infrastructure, continuous monitoring, DevOps processes, security, and continuous integration and deployment.

About Author

Ian Carnaghan

I am a software developer and online educator who likes to keep up with all the latest in technology. I also manage cloud infrastructure, continuous monitoring, DevOps processes, security, and continuous integration and deployment.

Follow Me