find Linux Commands

What is Linux find Command?

Explanation

find COMMAND:

find command finds one or more files assuming that you know their approximate filenames.

SYNTAX :


find path [options]

OPTIONS:


-name It search for the given file, in the current directory or any other subdirectory.
-atime n True if the file was accessed n days ago. The access time of directories in path is changed by find itself.
-ctime n True if the file's status was changed n days ago.
-group gname True if the file belongs to the group gname. If gname is numeric and does not appear in the /etc/group file, it is taken as a group ID.
-mtime n True if the file's data was modified n days ago.
-size n[c] True if the file is n blocks long (512 bytes per block). If n is followed by a c, the size is in bytes.

EXAMPLE:


  1. find -name 'cal.txt'

    The system would search for any file named 'cal.txt' in the current directory and any subdirectory.
  2. find / -name 'cal.txt'

    The system would search for any file named 'cal.txt' on the root and all subdirectories from the root.
  3. find -name '*' -size +1000k

    The system would search for any file in the list that is larger than 1000k.

Ask Questions

Ask Question