If you
are only interested in files of a certain type, use the -type
argument, followed by one of the characters in Table 9-1. Note, though that some
versions of find don't have all of
these.
Unless you are a system administrator, the important types are directories,
plain files, or symbolic links (i.e., types d
, f
, or
l
).
Using the -type operator, here is another way to list files recursively:
% find . -type f -print | xargs ls -l
It can be difficult to keep track of all the
symbolic links in a directory. The next command will find all the symbolic links
in your home directory and print the files to which your symbolic links point.
$NF
gives the last field of each line,
which holds the name to which a symlink points. If your find doesn't have a -ls operator, pipe to xargs ls
-l as previously.
% find $HOME -type l -ls | awk '{print $NF}'
— BB