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.
, 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.
Do not search file systems other than the file system from which you started.
Specify that the file was accessed at least n*24 hours ago.
Look only for files changed at least n*24 hours ago.
Find a file that has i-node n.
Specify that the file was accessed n minutes ago.
Look only for files that were changed n minutes ago.
Find empty files.
Specify that the file was modified n minutes ago.
Search only for files modified n*24 hours ago.
Find files whose UID does not correspond to a real user in /etc/passwd.
Look only for files whose GID does not correspond to a real group in
-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 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
Common find Command Options