Wednesday, October 6, 2021

thumbnail

How to use find command in Linux

Using find command to find and remove the files recursively 



1. Use the following command to find *.sql file type which is more than 15 days old and then delete all of them recursively. 

# find /path/to/database_dumps/ -name "*.sql" -type f -mtime +15 -exec rm -f {} \;

2. Use the following command to find 20* file type which is more than 15 days old and then delete all of them recursively. 

# find /path/to/file/ -type f -mtime +15 -exec rm -f {} \;
# find /opt/export/20* -type f -mtime +5 -exec rm -f {} \;
# find /root/ -name "*-20211109.log" -type f -exec cp {} /root/AllRsyncLogs/ \;
# find . -type f -not -name "*.html" -exec ls -l {} \;


 

Subscribe by Email

Follow Updates Articles from This Blog via Email

No Comments

Powered by Blogger.