The following are a few examples showing how to perform some common tasks using the “find” tool. I will add more as time goes on.
Basic syntax: find pathname... expression
#If you want to find files that are 7 days old, use the -mtime option
find . -mtime 7 -print
(Assuming today is 23-Dec, the command will show the files that are only dated 16-Dec.)
#An alternate way is to specify the range of periods
find . -mtime +6 -mtime -8 -print
find . -mtime +6 -mtime -8 -exec ls -lt {} \;
#Find files based on 7 days ago (atime means last accessed time)
find / -atime 7 -ls
#List old files and delete them (mtime means last modified/creation time of a file)
find -mtime +60 -exec rm -f {} \;
#Find core files in the directory and remove them
find . -name "core" -exec rm -f {} \;
Note:-
du -sh * | sort –nr
du -hsx * | sort -rh | head -10

