How to search for files on the command line in Linux

Written by Ian Carnaghan · 25 sec read >
  • 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]


    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

Last Updated On April 07, 2018
Written by 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. Profile

Leave a Reply

Notify of