Already once in DesdeLinux I showed them algunos commands that help us to see how we have occupied each MB on our hard drive, and among them I talked about du, a tool that has a lot of options, and that, with the help of some parameters, becomes more powerful.
According to Wikipedia:
du (Abbreviation of disk usage, disk usage) is a standard command for Unix family operating systems. It is used to estimate the hard disk space usage of a file, a particular directory, or files in a file system. Utility du first appeared in version 1 of AT&T Unix.
How to use it
If we want to specifically see the weight of a file or folder in the easiest and most humane way possible, we execute:
$ du -bsh Videos/
What will return to us:
du -bsh Videos / 215G Videos /
Now, let's see which are the heaviest directories that we have in our / home organized from highest to lowest:
$ du -sm *
What it returns to us:
$ du -sm * 1172 Downloads 68855 Documents 4084 Desktop 22270 Images 174192 Linux 50887 Music 3088 Projects 1379 Work 219515 Videos
If we only wanted to see which are, for example, the 5 heaviest directories in our / home, we could use du with a series of extra commands, for example:
$ du -sm * | sort -nr | head -5
Which would return:
$ du -sm * | sort -nr | head -5 219515 Videos 174192 Linux 68855 Documents 50887 Music 22270 Images
But the values they return to us are not "so human" as they are represented in MB and are more cumbersome to understand. That is why we run:
$ du -hs * | sort -nr | head -5
Which returns us:
$ du -hs * | sort -nr | head -5 215G Videos 171G Linux 68G Documents 50G Music 28K mageia-2013.svg
As you can see, contrary to what many people think, using the terminal is sometimes faster and more efficient than running a graphical application. Do you know of any other interesting combination for du?
SHUT UP AND TAKE MY ENTER !!!
To tell the truth, every time I look for these kinds of utilities, it makes me want to ditch the graphical interface and live at the end of the console (well, I'm already doing it in OpenBSD, but something is something).
In any case, with a console like Windows, I would dare to live without KDE or XFCE.
Errata. I meant Linux instead of Linux.
Errata. I meant Linux instead of Windows.
eliotime3000 by god !!! We understood you man 😀
The problem is that when it comes to commenting from Android, either I don't have space to see everything I write, so it turns out to be uncomfortable to write (I prefer my netbook before using my cell phone to write a comment).
Then comment when you sit in front of the computer .. ..we wait for you calmly .. there is no rush .. 😛
Thanks for the advice. It is that I can not avoid commenting from my cell phone as soon as the RSS reader notifies me of a new blog entry that is published.
Eliotime, opera doesn't get along very well in my case with desde linux. Fast, light and usable than those I tested, surpassing uc browser because it supports flash and YouTube videos in iframes and next browser. It's not heavy at all and works very well.
Erratum. Hahahaha apparently it identifies as safari with iOS I assume because it is a tablet
For those who like graphical interfaces more, I recommend the program called Filelight that you can find in the repositories of the vast majority of distros.
http://en.wikipedia.org/wiki/Filelight
Gnome's "Disk Usage Analyzer (Baobab)" is also an excellent choice. http://blogs.gnome.org/pbor/files/2012/09/Screenshot-from-2012-09-02-002755.png
du -s –yes *
yes but you have the command du -hs * | sort -nr | head -5 I find myself with the problem that it orders it numerically, not by weight, to sort them by weight you have to execute the command: du -hs * | sort -hr | head -5, I hope it could have served someone ^^
He served me, thank you
sudo du -sxm / [^ p] * | sort -nr | head -n 15
du -sm *. [^.] * | sort -nr | head -n 15
It is a good command but adding the -n option to sort will not correctly recognize the "human" numerical value and will show an 8,0K file as larger than a 7,9G file.
You must use the -h option to sort so that this does not happen.
PS: If you look at your example, the 5th heaviest file should have been Images and not mageia-2013.svg which only weighs 28K.
The problem with using 'du -hs *' is that they don't sort well by size. For example:
4'0K would appear before 3'5G
800K would appear before 50G
If the same thing happens to me:
$ du -hs * | sort -nr | head -5
577M torrents
549M Documents
288K sketchbook
200K Downloads
124M Podcast
While the real thing, because I know my system very well, is:
$ du -hsm * | sort -nr | head -5
86008 Videos
27328 Music
17947 Work
15108 Images
1672 Dropbox
... you have piqued my curiosity, I am going to investigate a little more about this interesting combination of commands.
Regards!
Oh my God! the correct thing is "about" not with "h", sorry.
Oh my God! the correct thing is "about" without "h", sorry.
Hello the command should be like this
du-sh * | sort -rh | head -n 5
In this way it will order them by weight.
regards
Check cdu: http://arsunik.free.fr/prog/cdu.html
$ cdu -idh -s
Good afternoon, reading this article I remembered that there is a tool that generates a .png or .jpg image from the folders that one selects, for example, / home, to place it as a wallpaper, it is a very geek wallpaper, I don't know if anyone knows why I don't remember his name. Thanks
Why do I post comments and they don't appear?
Do you press "Send to / dev / null" instead of "Post comment"?
just a correction. In the last example where you use "du -sh" the sort must be done with "sort -hr" because "human" values must be sorted with "human" sort. Sort is able to distinguish that 900K is less than 1MB, but if you limit yourself to the numerical ordering you won't notice.
Simply GREAT! Thank you for taking the time to publish this valuable post.
…A hug for you.
Hi all !!!
Fantastic all the contributions (even the lapses of guindou instead of Linux, heh) in this thread as in all of the forum! Now a small reflection: reading comments I see that it is true when they say in those parts that Linux users are not normal eh? hahaha Hugs !!! And free greetings to all!
Very very good; clean and simple. Thank you.