How to find Top 10 Big files/Folder in the system?
Linux - NewbieThis Linux forum is for members that are new to Linux.
Just starting out and have a question?
If it is not in the man pages or the how-to's this is the place!
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
# du -ha / | sort -h -r
sort: invalid option -- h
Try `sort --help' for more information.
Which version of sort are you using? Here is mine
Code:
$ sort --version
sort (GNU coreutils) 8.5
Copyright (C) 2010 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>.
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.
Written by Mike Haertel and Paul Eggert.
Briefly, sort is not a human. If you want sort to sort correctly, you have to feed it data in a form that it can work with. It doesn't know that, in this context, a K is worth 1000 (or is it 1024?) of not-a-suffix counts, and that an M is worth 1000 (or 1024) K counts.
The simplest thing is to stick with the non-human-readable form, but, if you really wanted you could
look at the 'G's first, count them, subtract from the total, move on to the 'M's, etc
work on the numbers in n-h-r form and convert them at the end (easier if k=1000, etc), for the human to read
neither of the above seem worth the effort, to me, but YMMV
$ sort --version
sort (GNU coreutils) 8.5
Copyright (C) 2010 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>.
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.
Written by Mike Haertel and Paul Eggert.
And what is the output of
Code:
sort --help
Code:
# sort --version
sort (GNU coreutils) 5.97
Copyright (C) 2006 Free Software Foundation, Inc.
This is free software. You may redistribute copies of it under the terms of
the GNU General Public License <http://www.gnu.org/licenses/gpl.html>.
There is NO WARRANTY, to the extent permitted by law.
Written by Mike Haertel and Paul Eggert.
# sort --version
sort (GNU coreutils) 5.97Copyright (C) 2006 Free Software Foundation, Inc.
This is free software. You may redistribute copies of it under the terms of
the GNU General Public License <http://www.gnu.org/licenses/gpl.html>.
There is NO WARRANTY, to the extent permitted by law.
Written by Mike Haertel and Paul Eggert.
Well, you are using a very old version of sort. Apparently sort did not have the '-h' option back then. Any chance that you can upgrade to the latest version?
Well, you are using a very old version of sort. Apparently sort did not have the '-h' option back then. Any chance that you can upgrade to the latest version?
It will then make the script not so general .
However I would love to update it to latest version.Any idea on how do i do it?
It will then make the script not so general .
However I would love to update it to latest version.Any idea on how do i do it?
Well, that depends on which system you are using. Normally your update-manager should keep it up to date. If this is not the case then *maybe* newer versions are not compatible with your system.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.