343
Chapter 21:
Introduction to Linux Systems Administration
example, to create a symbolic link so that /usr/bin/myadduser points to /usr/ local/
bin/myadduser, type the following:
[root@ford /root]# ln -s /usr/local/bin/myadduser /usr/bin/myadduser
find: Find a File
The find command enables you to find files based on a number of criteria. The
following is the command's general format:
[root@ford /root]# find start_dir [options]
where start_dir is the directory from which the search should start.
find
, like the other commands that we have already discussed, has a large number
of options that you can read about on its man page. Table 21-5 list the most common
options used with find.
Option
Description
-mount
Do not search file systems other than the file system from which you started.
-atime n
Specify that the file was accessed at least n*24 hours ago.
-ctime n
Look only for files changed at least n*24 hours ago.
-inum n
Find a file that has i-node n.
-amin n
Specify that the file was accessed n minutes ago.
-cmin n
Look only for files that were changed n minutes ago.
-empty
Find empty files.
-mmin n
Specify that the file was modified n minutes ago.
-mtime n
Search only for files modified n*24 hours ago.
-nouser
Find files whose UID does not correspond to a real user in /etc/passwd.
-nogroup
Look only for files whose GID does not correspond to a real group in
/etc/group.
-perm mode Specify that the file's permissions are exactly set to mode.
-size n[bck] Search only for files at least n blocks/characters/kilobytes big. One block
equals 512 bytes.
-print
Print the filenames found.
-exec cmd\; On every file found, execute cmd. If you are using the bash shell, be sure to
follow every cmd with a \; otherwise, the shell will become very confused.
-name name Specify that the filename should be name. You can use regular expressions
here.
Table 21-5.
Common find Command Options