

perm option in find allows to find files with specific permissions. Find all files whose permission is 644 except the ones present in the temp directory: Using the -type f option, find will find only the regular files alone.ġ1. type d -name temp -prune -o -type f -mtime -1 -print

Find only regular files modified in the last one day except the ones present in the temp directory: Usage of mtime makes find to search for files modified in the last day alone.ġ0. type d -name temp -prune -o -mtime -1 -print Find all files modified in the last one day except the ones present in the temp directory: To specify multiple directories with the -name option, -o should be used as an OR condition.ĩ. type d \( -name C -o -name temp \) -prune -o -name "*.c" -print c files except the ones present in the C and temp directory: c files are found and printed except the ones present in C.Ĩ. The 1st part prunes out the C directories. type d -name C -prune -o -name "*.c" -print c files except the ones present in the C directory: The only difference here is the print statement being present in the first half as well.ħ. Also print the temp directories if present: Find all the files except the ones under the temp directory. Printed from the 1st part of the condition.Ħ. In this find command, -print is associated in the other side of the OR condition, and hence nothing will get Print files only on explicit print instructions. However, once the -print option is specified, it will By default, the find command prints all the files matching the criteria. Due to the OR condition, all the other files(files other than the ones present in the tempĭid you expect the temp directory to get printed? In the last example, we saw the directories.
