In a partition I have several files and folders, and I can list all those file sizes with du like this:
du -h
But how can I list all the files which are beyond a specific disk space size like 5MB?
|
In a partition I have several files and folders, and I can list all those file sizes with
But how can I list all the files which are beyond a specific disk space size like 5MB? |
||||
|
Here is a straight-forward solution in bash, which analyzes the size of both files and folders:
first param is the target folder to examine |
|||||||
|
That should list anything over 20k in /home/stephenm to recurse into sub directorys drop the |
|||||||||||
|
|
Be careful: You can create a 10 MB file, which uses much less:
An example is a compressed file that uses less space on disk that its size, of like the example above a sparse file. In the example above, If you know you do not have newlines in your filenames, you can filter the output of
If you can have newlines in your filenames, you could use this GNU extension, but then use something else than
|
||||
|
find /path -type f -size +5M -exec ls -lh {} \;– Terry Wang Dec 27 '12 at 12:23