Skip to content

find COMMAND

July 24, 2010

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

SYNTAX:
The Syntax is
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.

Advertisements

From → Unix

Leave a Comment

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: