no way to compare when less than two revisions
Differences
This shows you the differences between two versions of the page.
— | tech:linux:find_command [2014/12/04 12:45] (current) – created - external edit 127.0.0.1 | ||
---|---|---|---|
Line 1: | Line 1: | ||
+ | ====== find command ====== | ||
+ | Common uses | ||
+ | |||
+ | ===== Deleting old files with find command ===== | ||
+ | Below is an example of deleting MySQL backups older than 7 days | ||
+ | <code bash> | ||
+ | BACKUPLOC="/ | ||
+ | MYSQLBACKUPLOC=" | ||
+ | find $MYSQLBACKUPLOC/ | ||
+ | </ | ||
+ | |||
+ | Better syntax | ||
+ | <code bash> | ||
+ | JOBLOG="/ | ||
+ | find $JOBLOG/ -type f -name " | ||
+ | </ | ||
+ | |||
+ | ===== Deleting files with a certain extension across directories ===== | ||
+ | This will delete all *.txt.gzip files | ||
+ | <code bash> | ||
+ | find . -name " | ||
+ | </ | ||
+ | |||
+ | ===== Created/ | ||
+ | <code bash> | ||
+ | FILELOC="/ | ||
+ | # Created in the last 60 minutes | ||
+ | find $FILELOC -cmin -60 | ||
+ | # Modified in the last 60 minutes | ||
+ | find $FILELOC -mmin -60 | ||
+ | # Accessed in the last 60 minutes | ||
+ | find $FILELOC -amin -60 | ||
+ | </ | ||