Examples

find -name ‘mypage.htm’

In the above command the system would search for any file named mypage.htm in the current directory and any subdirectory.

find / -name ‘mypage.htm’

In the above example the system would search for any file named mypage.htm on the root and all subdirectories from the root.

find -name ‘file*’

In the above example the system would search for any file beginning with file in the current directory and any subdirectory.

find -name ‘*’ -size +1000k

In the above example the system would search for any file that is larger then 1000k.

find . -size +500000 -print

Next, similar to the above example, just formatted differently this command would find anything above 500MB.

find /home/sam -name ‘thefile*’ -exec ls -l {} \; # This will display each file – no delete
find /home/sam -name ‘thefile*’ -exec rm -i {} \; # This will delete each file after you confirm the delete
find /home/sam -name ‘thefile*’ -exec rm -f {} \; # This will delete each file without confirmation

Find and delete the directory

find . -iname « thedirectory » -exec echo rm -rf {} \; # This will delete each directory without confirmation

find . -iname « thedirectory » -exec echo rm -ri {} \; # This will delete each directory after you confirm