Finding Files in a Directory Tree by Size

To find files of a certain size, use the `−size' option, following it with the file size to match. The file size takes one of three forms: when preceded with a plus sign (`+'), it matches all files greater than the given size; when preceded with a hyphen or minus sign (`−'), it matches all files less than the given size; with neither prefix, it matches all files whose size is exactly as specified. (The default unit is 512−byte blocks; follow the size with `k' to denote kilobytes or `b' to denote bytes.)

To list all files in the `/usr/local' directory tree that are greater than 10,000 kilobytes in size,type:

$ find /usr/local −size +10000k RET

To list all files in your home directory tree less than 300 bytes in size, type:

$ find ~ −size −300b RET

To list all files on the system whose size is exactly 42 512−byte blocks, type:

$ find / −size 42 RET

Use the `−empty' option to find empty files−−files whose size is 0 bytes. This is useful for finding files that you might not need, and can remove. · To find all empty files in your home directory tree, type:

$ find ~ −empty RET

NOTE: To find the largest or smallest files in a given directory, output a sorted listing of that directory

Posted on: 16/12/2009

If you want to leave a comment please Login or Register
How to backup your data using rsync......
Understanding autoconf......
The Basics of fdisk......
Accessing Memory Using DMA......
The fd Directory......