Find command
From NetworkCommands
A command line program available on most Unix and Linux systems; used to search for files and/or directories.
Contents |
Usage Syntax
find path [option] string [[option] string]]...
Common options include;
- -name - find files by name
- -user username - find files owned by the specified user
- -type (d|f|l) - find only files, directories or symbolic links
- -size - find only files equal to, greater or smaller than the specified size
- -perm - find files by permissions
- -mtime days - find files last modified within the specified number of days
- -atime days - find files last accessed within the specified number of days
- -ctime days - find files that last had their permissions changed within the specified number of days
- -mmin minutes - find files last modified within the specified number of minutes
- -amin minutes - find files last accessed within the specified number of minutes
- -cmin minutes - find files that last had their permissions changed within the specified number of minutes
Usage Notes
When searching by file name string can be composed of any combination of characters and regular expressions.
As indicated above, multiple options can be used together to refine a search.
Usage Examples
Find By Name
find . -name "*.conf"
Find By User
find . -user username
Find By Name & User
find . -name "*.conf" -user apache
Find By Non-existant User
find . -nouser
Find By Type
find . -type d - Only directories
find . -type f - Only files
Find By Size
find directory -size +1024M
find directory -size -600c
- b - for 512-byte blocks (default)
- c - for bytes
- k - for Kilobytes (units of 1024 bytes)
- M - for Megabytes (units of 1048576 bytes)
- G - for Gigabytes (units of 1073741824 bytes)
Find By Day
find . -mtime -1 - Modified in the last 1 day
find . -atime -1 - Accessed in the last 1 day
find . -ctime -1 - Permissions changed in the last 1 day
Find By Minute
find . -mmin -5 - Modified in the last 5 minutes
find . -amin -5 - Accessed in the last 5 minutes
find . -cmin -5 - Permissions changed in the last 5 minutes
Find By Permissions
find . -perm 777
Operators
! - Except
-o - Or
Linux Usage Notes
With most Linux or Unix commands;
- Brief help can be displayed using the option/keyword: -h or --help, for example: chmod --help
- A full command manual can be displayed using the man command followed by the command name, for example: man chmod
- Sometimes 'info' pages are used instead of or to provide more information than man pages; for example: info chmod
- Version information can be display using the option/keyword: -v or --version, for example: chmod --version
Related Articles
You may find our regular expressions guide useful
Information on other Linux commands
Information on F5 BigIP commands
Information on Cisco commands
Information on Vyatta commands
Information on Extreme commands
Information on Blue Coat SGOS commands
Information on Nokia IPSO commands







