How to find all files with size greater than.
Is there any GUI software that can explore a tree and find all files with size greater than some amount? Neither Nautilus nor Nemo seem to be able to do this. In my memory, I could do this with PC-Tools in DOS 3.0.
4 Answers 4
sudo apt-get install baobab baobad
There is a bunch more on this question of SuperUser, but for all ends and propose baobad is enough.
Thank you Braiam, but baobab can’t be useful as it won’t have file search/sort option. More, since Unity the menu is broken (no more edit/preferences to exclude files/folder) and I get an error analysing my own «/home/me or some of its subfolders», maybe authorizations of .ssh, and no message to direct me to a log. so. find may work better, but it is not a gui, and everytime (which is not often) it could be useful, in the urgency, I forgot the syntax, so. find is not for my humanity.
@useful there are a bunch more on the SU link, I won’t bother to bring them since. mm. it will give the impression that you want a list and you want not (nor is encouraged in SE), either way, give the link a shot, if you feel that some of them solves your problem. BTW, as you can notice I prefer CLI solutions over GUI’s since. mmm. I’m like that ;).
When I need make more free space on servers I use this command. It find all files bigger then 50 MB and «du -h» make berret list of files and «sort -n» after pipe make list numericcaly sorted by file size.
find / -type f -size +50M -exec du -h <> \; | sort -n
Oh what a nice a handy GUI. It is just too easy for a newb like me, but waiting for the same in assembly language. waiting for the machine code which is the top in elegance, I’ll stick to gnome-search-tool. -1
I know you search GUI tool, but if you will learn more with Bash then you know this in all distros and environments. For easier understanding I explain this for you. If you need I can explain this in more details, it is really easy and very useful.
Thank you zorbon.cz. Sorry for my ironic way, but I have so much other issue with command line tool that should work just as intended but doesn’t, so then I easy get irascible when some answer comes that obviously doesn’t take care of the care I asked with. Well the point is that I’m not that newb, intermediate computers user instead, so I often run in frustration with Linux. yes I know it’s the price of freedom and there is still Windows if I want to switch back. but I put the finger in the shredder. Anyway I recognize your gentle pre-comment on your command line: I didn’t see it at first
My main frustration is how could I dare advise anyone to use this OS when I can’t even help myself so often.
Sorry, maybe one of my reason to answer that is fact that I now use Windows 8.1 🙂 since Windows 8 RTM (more than 2 years) and I can not switch back to linux (and I’d like do it), because there are not alternatives to some tools) and now I donť know «nothing» about GUI. But I see CLI every day as sysadmin (I manages higher tens of servers running on CentOS or some on Debian). I understand your last mention and it is true fact.
gnome-search-tool is what I use. Very simple. It has the «Size is at least» filter where you can specify minimum file size. See screen print for searching my ISOs folder with a minimum size of 10,000,000 KB in size.
Thank you rik.shaw, I completly forgot this since I use unity, and as I thought gnome-search-tool was a feature/companion of Nautilus (what I now know is false) growing . more and more spartan, so I switched to Nemo (which, btw, doesn’t help more in that matter of searching), so I was stuck. I will give a try back to it although I remember issues in gnome-search-tool keeping searching for hours when it met unauthorized directories or files or looping through links. Anyway, even if there isn’t a better tool, at least it was the kind of answer I expected. Thank you again.
List files over a specific size in current directory and all subdirectories
How can I display all files greater than 10k bytes in my current directory and it’s subdirectories. Tried ls -size +10k but that didn’t work.
could you please expand on this question, or at least explain why the two solutions that were posted — and work, are not appropriate to your assignment. (edit: added please)
ls doesn’t have any options to filter output by size. It does have a —size option (with no arguments) which prints the size of each file in blocks. By the way, -size +10k seems like a syntax that is used with find .
Stack Overflow is a site for programming and development questions. This question appears to be off-topic because it is not about programming or development. See What topics can I ask about here in the Help Center. Perhaps Super User or Unix & Linux Stack Exchange would be a better place to ask. Also see Where do I post questions about Dev Ops?
5 Answers 5
find . -size +10k -exec ls -lh <> \+
the first part of this is identical to @sputnicks answer, and sucesffully finds all files in the directory over 10k (don’t confuse k with K), my addition, the second part then executes ls -lh or ls that lists(-l) the files by human readable size(-h). negate the h if you prefer. of course the <> is the file itself, and the \+ is simply an alternative to \;
which in practice \; would repeat or:
ls -l found.file; ls -l found.file.2; ls -l found.file.3
where \+ display it as one statement or:
ls -l found.file found.file.2 found.file.3
Additionaly, you may want the listing ordered by size. Which is relatively easy to accomplish. I would at the -s option to ls , so ls -ls and then pipe it to sort -n to sort numerically
find . -size +10k -exec ls -ls <> \+ | sort -n
or in reverse order add an -r :
find . -size +10k -exec ls -ls <> \+ | sort -nr
finally, your title says find biggest file in directory. You can do that by then piping the code to tail
find . -size +10k -exec ls -ls <> \+ | sort -n | tail -1 would find you the largest file in the directory and its sub directories.
note you could also sort files by size by using -S, and negate the need for sort. but to find the largest file you would need to use head so
find . -size +10k -exec ls -lS <> \+ | head -1
the benefit of doing it with -S and not sort is one, you don’t have to type sort -n and two you can also use -h the human readable size option. which is one of my favorite to use, but is not available with older versisions of ls , for example we have an old centOs 4 server at work that doesn’t have -h
Find files of specified size using bash in Unix [closed]
That command gives me find: unknown predicate ‘-print.’ I presume the . isn’t really there. Precision is important.
Stack Overflow is a site for programming and development questions. This question appears to be off-topic because it is not about programming or development. See What topics can I ask about here in the Help Center. Perhaps Super User or Unix & Linux Stack Exchange would be a better place to ask. Also see Where do I post questions about Dev Ops?
3 Answers 3
find . -size +10000k -exec ls -sd <> +
If your version of find won’t accept the + notation (which acts rather like xargs does), then you might use (GNU find and xargs , so find probably supports + anyway):
find . -size +10000k -print0 | xargs -0 ls -sd
or you might replace the + with \; (and live with the relative inefficiency of this), or you might live with problems caused by spaces in names and use the portable:
find . -size +10000k -print | xargs ls -sd
The -d on the ls commands ensures that if a directory is ever found (unlikely, but. ), then the directory information will be printed, not the files in the directory. And, if you’re looking for files more than 1 MB (as a now-deleted comment suggested), you need to adjust the +10000k to 1000k or maybe +1024k , or +2048 (for 512-byte blocks, the default unit for -size ). This will list the size and then the file name. You could avoid the need for -d by adding -type f to the find command, of course.