Find linux command

From Knowledge Center
Revision as of 08:06, 29 July 2020 by Ruan (talk | contribs)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

Find specific files

To find only files with .txt extension:

$ find /home/to/ -type f -name "*.txt"

To find only directories ending with -bar:

$ find /home/to/ -type d -name "*-bar"

Find and Delete:

Find files older than 30 days and delete:

$ find /var/logs/ -mtime +30 -exec rm -rf {} \;