Find linux command

From Knowledge Center
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 {} \;