Help finding three largest files on system
Hi, I'm having problems with a bash script command to find the three largest files on my system. This is probably fairly simple, but I've been at this for hours without luck.
I've done some research and it seems as though # ls -lh | sort +4n | tail -3 is what should relay the information I need, but when typed, it comes up with the error +4n: No such file or directory. Is there another way around this? I've also tried # du -a / | sort -n -r | head -n 3 but this is giving me the largest directories under root. Having issues.:o Thanks. |
Have you looked at the 'S' option for ls
|
Maybe you did mean
Code:
sort -k5n |
Thanks colucix, I think the find is better suited to what I am searching for.
Code:
find . -size +"." -a -size -"." Code:
find . | sort -n -r | head -n 3 |
Quote:
Anyway, your command does not work as you expect. First run the find command alone and see what is the output. Then think about the first command after the pipe (sort -n)... is there something in the output of find that can be sorted numerically? Does the find command print out the file size if you don't force it explicitly? An hint: in the man page of find (or in the GNU find online manual) look at -size (to restrict the search to files greater than...) and -printf (to customize the output). |
All times are GMT -5. The time now is 11:51 AM. |