Linux - GeneralThis Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then 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.
Is there not an easy way in Linux CLI to view a folder and have it spit out the size of the directory and everything in it?
Lets say I have a folder called "data" and in this folder were many sub-folders and files that equal ~45GB's. If I run the "du -h /path/to/data, it will sit there for an hour sorting through all the folders and sub folders until it reaches the bottom and spits out the final tally for /path/to/data
Code:
47GB /path/to/data
I don't need to see a huge break down of the sub folders and everything else...I just want it to tell me how big "data" is beyond the generic 4k folder size you get with "ls -lh" command.
Well if the folder is large even windows has to search the directory tree to give you the size of the folders contents. It does however do this faster somehow. Maybe you can email the Redmond guys and ask them how they do it :P
Well if the folder is large even windows has to search the directory tree to give you the size of the folders contents. It does however do this faster somehow.
I don't know that I would say it was any faster. He's talking about an awful lot of data...
Yeah but the annoyance is that in Windows XP, I can right click a folder and select properties and see the size of the folder or you can just view "list view" and it list everything next to each folder almost instantly regardless of the size.
So far in Linux, I don't see this being possible without Linux having to list or scan through every single file which can take hours.
It's not the OS that determines this speed. It's more the filesystem and it's implementation.
If you have a lot (ie thousands) of very small files, all filesystems are slow and directory sizes will be too...
Windows isn't that fast either. Otherwise, people wouldn't have written special tools to calculate directory sizes.
In explorer, if you select all items in a folder, you immediately get the total size on the left, but that doesn't include the contents of directories (recursively). That's why it's much faster.
It's only when you right-click, select properties of a folder that you get total size, which is calculated rather slowly (you can see it increment bit by bit).
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.