From s23
Jump to navigation Jump to search


see also: mansearch, man2html


If you want to suppress error messages such as[edit]

find / -name file 
find: cannot read dir /lost+found: Permission denied

as these messages are written to errout and not stdout, a nice trick is to pipe errout to null

find / -name file 2> /dev/null

EXAMPLE : find /var/log/ -name "20*-*-*_*.log*" -mtime +80 -exec rm {} \;
          deletes all files older than 80 days

Find files files accessed more then +n, less then -n days[edit]

find . -mtime -100
find . -mtime +100

Find and delete all files not access for more then 24 hours[edit]

find . -atime +1 -exec rm '{}' \;

Grep through all files recursively[edit]

find / -type f -exec grep -li {} \;