How to search for files on the command line in Linux

  • 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

Image Credits: Photo by Isis França on Unsplash.

More Similar Posts

No results found.