admin 发表于 2020-9-20 10:09:28

find

-a-c-m得意义-atime n
Filewaslastaccessedn*24 hours ago.When find figures out how many 24-hour periods ago the file was last accessed, any fractional part is ignored, so to match -atime +1, a file has tohave been accessed at least two days ago.

-ctime n
File's status was last changed n*24 hours ago.See the comments for -atime to understand how rounding affects the interpretation of file status change times.

-mtime n
File’s data was last modified n*24 hours ago.See thecommentsfor-atimetounderstandhow rounding affects the interpretation of file modification times.n,+n,-n得意义
找“5天之内被更改过的档案名”find / -mtime -5

找“5天前的那一天被更改过的档案名”find / -mtime 5

找“5天之前被更改过的档案名”find / -mtime +5示例

find ./bdump -name *.trc -mtime +15 -exec rm -f {} \;

find /rman_backup/data -ctime 5 -exec rm {} \;

find /monitor/nmon/daily -mtime +120 -name "*.nmon" -exec rm -rf {} \;

find ./ -mtime -3 |xargs tar -zcvf ./osw_archives.tar.gz

页: [1]
查看完整版本: find