| Display the current directory sorted by time, in reverse order. | ls -ltr |
| Count files in the current directory. | ls -l | wc -l |
| Display files between 1 and 2 days old. | find . -ctime 1 | xargs ls -l |
| Display files more than 2 days old. | find . -ctime +2 | xargs ls -l | less |
| Delete unconditionally files older than 2 days. | find . -ctime +2 | xargs rm -f |
| Display files modified between 6 and 9 minutes ago. | find . -mmin +5 -mmin -10 | xargs ls -l |
| Move files created more than 1020 minutes ago from the current directory into the 20070512/ directory . | find . -cmin +1020 | xargs -i mv {} 20070512/ |
| List files between 1200 minutes and 1600 minutes old, matching the pattern index* . | find . -mmin +1200 -mmin -1600 -name 'index*' | xargs ls -l |
| To a subdirectory depth of 3, find files in subdirectories containing 'abc' in their names and having a size greater than 200 bytes. | find . -maxdepth 3 -type f -name "*abc*" -size +200c |
| To a subdirectory depth of 3, find files in subdirectories with a name of target and a size greater than 200 characters, and rename them to target.large . | find . -maxdepth 20 -type f -name "target" -size +200c -exec mv "{}" "{}".large \; |
| For a maximum subdirectory depth of 20, find files named index.php, index.php3, index.html, or index.htm that contain the text "<script>function" and write what is found to output file "script_functions.txt" (finds certain kinds of injected spam). | find ./ -maxdepth 20 -type f \( -name "index.php" -o -name "index.php3" -o -name "index.html" -o -name "index.htm" \) -exec grep -H --line-buffered "<script>function" '{}' >> ./script_functions.txt \; |
| In the current directory, find files with names beginning "__132." and pass each one to grep, to search for the string "<script>function" within each file pasted from the find command. | find . -name "__132.*" -exec grep -i '<script>function' "{}" \; |
| rename every file in the directory to only the second and third nodes delimited by ".", dropping the first node in the filename | ls -1 ./ | awk -F. '{print "mv "$1"."$2"."$3" "$2"."$3 }' | sh |