You may be wondering what you can do with all these files that you find!
Well, find
has the ability to act on the files that it finds by
using the -exec
option. This option accepts a command line to
execute as its argument, terminated with ;
; and replacing any
occurrences of {}
with the filename. This is best understood with
an example:
$ find /usr/bin -type f -size -50c -exec ls -l '{}' ';'
-rwxr-xr-x 1 root root 27 Oct 28 07:13 /usr/bin/krdb
-rwxr-xr-x 1 root root 35 Nov 28 18:26 /usr/bin/run-nautilus
-rwxr-xr-x 1 root root 25 Oct 21 17:51 /usr/bin/sgmlwhich
-rwxr-xr-x 1 root root 26 Sep 26 08:00 /usr/bin/muttbug
As you can see, find
is a very powerful command. It has grown
through the years of UNIX and Linux development. There are many other useful
options to find
. You can learn about them in the find
manual page.