next up previous contents
Next: Sorting files Up: Other useful commands Previous: Finding files in your   Contents

Using find for useful tasks

The command find is a powerful tool that can be used for many tasks that operate on a whole directory.

For example, you can find all files that were modified in your home directory in the last 30 minutes with the following use of the find command.

[amit@onyx docs]: find ~ -mmin -30 -print
/home/amit
/home/amit/.kde/share/config
/home/amit/.kde/share/config/kdesktoprc
/home/amit/.kde/share/apps/kalarmd
/home/amit/.kde/share/apps/kalarmd/clients
/home/amit/.Xauthority
/home/amit/.viminfo
/home/amit/public_html/teaching/handouts
/home/amit/public_html/teaching/handouts/cs-linux.tex
/home/amit/public_html/teaching/handouts/.cs-linux.tex.swp
/home/amit/public_html/teaching/253/notes
/home/amit/res/qct/pds/sect7/s7ods_orig.tex
/home/amit/res/qct/pds/sect7/s7ods_hash.tex
/home/amit/.amit-calendar.ics
[amit@onyx docs]:

One of the most powerful uses of find is the ability to execute a command on all files that match the pattern given to find. Here are some examples:


next up previous contents
Next: Sorting files Up: Other useful commands Previous: Finding files in your   Contents
Amit Jain 2009-08-23