I need to find a file in my current directory whose size should be less than or equal to 10 MB.
ls -lh
gives me the file size of each file but not sure how to find the files whose size are less than or equal to 10 MB.
host@407d:t1_snapshot$ ls -lth
Is there any way I can do that? I am running ubuntu 12.04
Best Answer
find . -type f -size -10485760 -ls
run in your current directory or you can dofind /etc/home/user/stuff -type f -size -10485760 -ls
using a pathso, my format is basically
find path
of-type f
(file) with-size
of less than (-
)10485760
(10MB in B) and-ls
to make it pretty for you. Per Dennis' suggestion adding-maxdepth 1
would prevent recursing into subdirs, if that is what you desire