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.
Distribution: RH 7.3/8.0/9.0, Debian Stable 3.0, FreeBSD 5.2, Solaris 8/9/10,HP-UX
Posts: 340
Rep:
To know the size of all files in a directory
Is there a command line quick way to show the size of all files in a directory (i.e. upto the depth of the directory tree)? Managed to do it with a script, although it doesn't traverse the whole directory tree associated with that directory.
Hi , i feel your problem is there are a lot of subdirectories under a single directory and you want to know the size of each file and the total size .. issue du -mh as the command in the console you will get a message like this
Distribution: RH 7.3/8.0/9.0, Debian Stable 3.0, FreeBSD 5.2, Solaris 8/9/10,HP-UX
Posts: 340
Original Poster
Rep:
Hello shaheen,
so that means that all the files inside that directory and other subdirs, amount to 696K?
I mean, I want a facility just like Windows which gives you the total size of that folder (i mean, with all files, and files inside subdirectories, and so on...)
Dear ganninu , yes the command i posted displays the directory and the subdirectory list inside the directory from where you are issuing the command. So that 696k is the combined size of all the directory , subdirectory and the files inside them. I had other files inside the root directory thats why the file size showed 696k ,, du -mh doesnt show the size of files , thats reasonable bcos that is available by issuing ls -al /path/to/your/directory .. it will show the size of individual files ... but if you just want the complete size of all the files and the subdirectories inside the operable directory just issue that du -mh .. the last value is the combined size ,, but if you just want the complete size and not the individual size of the subdirectories ,, issue du -ksh ... you will only get that 696K not the subdirectory sizes .. i feel this is what you precisely want ... Hope this works , let me know if this clears out the problem ,, best of luck
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.