A collection of commonly used commands for Linux server management


1. Find and delete files a few days ago

find  path2Delete  -name '*filename*' -mtime +n |xargs rm -f

The above command requires three parameters:

path2Delete: The folder path where old files need to be deleted;

filename: the name of the file to be deleted;

n: Need to delete data a few days ago.

Example: find /var/log -name "*" -mtime +10|xargs rm -f

Delete all files under the /var/log path whose time is 10 days ago.

Guess you like

Origin blog.csdn.net/codemanship/article/details/45096193
Recommended