81
19
How can I make ls (or any other command) list only files bigger than a specific file size?
81
19
How can I make ls (or any other command) list only files bigger than a specific file size?
138
Use find and its -size
flag.
To find files larger than 100MB:
find . -type f -size +100M
If you want the current dir only:
find . -maxdepth 1 -type f -size +100M
25
If you wish to see all files over 100M and to see where they are and what is their size try this:
find . -type f -size +100M -exec ls -lh {} \;
1
I think it would be easier to use printf parameter -printf "%p %s"
. See: http://unixhelp.ed.ac.uk/CGI/man-cgi?find
@Nux: nice tip. -printf '%9s %p\n'
worked well for me. – seanf – 2015-05-29T05:40:21.200
Building on this answer: find /var/lib/docker/containers -name "*-json.log" -type f -size +100M -exec /bin/cp -f /dev/null {} \;
– Rich K. – 2020-02-12T20:09:36.450
1Does the same as @Nifle's first command – Canadian Luke – 2014-05-21T17:33:48.600
2
Use the following:
find / -size gt 2MB
or:
find / -size => 2000000
3How does this improve the accepted answer? – Dave M – 2017-02-27T13:18:33.970
Though we thank you for your answer, it would be better if it provided additional value on top of the other answers. In this case, your answer does not provide additional value, since another user already posted that solution. If a previous answer was helpful to you, you should vote it up instead of repeating the same information. – Toby Speight – 2017-02-27T13:42:25.743
2
If you need to pass the size in bytes, use
– aexl – 2017-08-08T09:19:12.187find . -type f -size +4096c
(https://superuser.com/a/204571/111289)