Find files with more than 10MB
| The code is as follows |
Copy Code |
Find. -type f-size +10000k-exec ls-lh {}; | awk ' {print $ ': ' $} ' |
Find Path-size +2000k-print
This allows you to print all files that are larger than 2000K in the specified path (less than the minus sign), and filter to increase speed and bandwidth as needed. If you want to add a time, you can write a-and-mtime-1 in the back, indicating that the file changes within 24 hours of the day.
The Find command under Linux is used to look up files, and it is known to be omnipotent through man finds. So it's a cinch to find files by file size. Search for size from man find, you can see the following information:
-size N[CWBKMG]
File uses n units of space. The following suffixes can be used:
b for 512-byte blocks (here is the ' default if no suffix is used)
C for bytes
W for two-byte words
K for kilobytes (Units of 1024 bytes)
M for megabytes (units of 1048576 bytes)
G for gigabytes (units of 1073741824 bytes)
Note: The default unit is B, and it represents 512 bytes, so 2 means that 1k,1m is 2048, if you do not want to convert, you can use other units, such as C, K, M and so on.
Example: Find files with a file size of 2048 (2k) bytes in the current directory
Find./-size 4
Or
Find./-size 2048c
Or
Find./-size 2K The above lookup file is equal to the specified size, can you query for files greater than or less than a specified value, the answer is yes, for example:
Look for files larger than 2K, + = greater than
Find./-size +2048c
Look for files less than 2K-represents less than
Find./-size +2048c-type F