DOC HOME SITE MAP MAN PAGES GNU INFO SEARCH PRINT BOOK
 
Administering filesystems

Locating files

You can locate all files with a specified name, permissions setting, size, type, owner, or last access or modification date using find(1). Use this command to locate seldom-used or excessively large files, files owned by a particular user, temporary files, core files, and any unused a.out files.

The syntax of find is:

find pathname option

pathname is the pathname of the directory to search. The find command searches recursively, downward through all the directories under the named directory, for files that match the criteria specified by option.


NOTE: You must include the -print option for find to display the list of files that match the search criteria.


Finding specific files by name (-name)
For example, to locate and display all files named temp recursively in the /usr directory, enter:

find /usr -name temp -print


Finding files of a certain size (-size)
For example, to locate and print a list of all the files greater than three blocks in size in all the directories (/ and below), enter:

find / -size +3 -print


Finding files by owner (-user)
For example, to find all files in the /work directory owned by olivier, enter:

find /work -user olivier -print


Finding files of a certain type (-type)
For example, to locate all the directories in /usr/spool/uucp, enter:

find /usr/spool/uucp -type d -print


Finding files by permissions (-perm onum)
onum is the octal number used with chmod(1).
For example, to locate and display all the files in the /usr directory that give all users read, write, and execute permissions (onum is 0777), enter:

find /usr -perm 0777 -print

See also:


Next topic: Finding temporary files
Previous topic: Displaying filesystem and directory usage statistics

© 2004 The SCO Group, Inc. All rights reserved.
UnixWare 7 Release 7.1.4 - 22 April 2004