Linux operation and maintenance commonly used commands and knowledge Daquan

  
 

1. Find all files ending in .tar in the current directory and move to the specified directory:

find . -name "*.tar" -exec mv {} ./backup Annotation: find &ndash ;name is mainly used to find a file name, -exec, xargs can be used to take the previous results, and then the action to be executed, generally used with find a lot, find use us can extend -mtime to find the modification time, - Type is the specified object type (commonly includes f for files, d for directories), -size specifies the size, for example, it is often used: finds the LOG file larger than 100M 30 days before the current directory and deletes it.

find . -name "*.log" –mtime +30 –type f –size +100M

Copyright © Windows knowledge All Rights Reserved