Forum Moderators: bakedjake

Message Too Old, No Replies

Anybody know a short recursive size check?

         

littleman

4:42 pm on May 30, 2003 (gmt 0)



Anybody know a quick way to check the total size of a directory via command line?

dingman

4:49 pm on May 30, 2003 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



du -sh path/to/dir

's' means a summary - just show the sizes of files/directories explicitly listed on the command line. Otherwise, 'du' will list size for every file in a named directory. 'h' is for "human-readable" output - it will pick a reasonable size unit to display in, and mark it as mb, kb, gb, etc.

very useful way to find where your biggest disk usage in a dir is:

du -sm /path/to/dir/* ¦ sort -n

list disk usage of each sub-dir or file in the top level of /path/to/dir, sorted by size in megabytes.

bartek

4:50 pm on May 30, 2003 (gmt 0)

10+ Year Member



du -h /dir

This checks size on disk, not a precise "science".

dingman

4:59 pm on May 30, 2003 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



example:

dingman@andrew:~$ du -sm * ¦ sort -n 
.
.
.
1 wedding_photos
3 public_html
3 viavoice
3 visor-backup
5 MyPilot
6 software
7 cps_docs
7 cs_politics
10 gnucash
16 MyVisor
25 employment
28 War_of_the_Worlds.mp3
37 financial_records
38 Mail
82 temp
84 classwork
180 dingman1-home
251 evolution
806 kernel
1028 mp3

looks like 'cd kernel; make clean' might be a good idea if I'm short on disk space :) Likewise, I really oughta get that blasted cable to connect my CD-ROM to my sound card so I don't have to rip all my disks to play them in my office anymore.

littleman

5:09 pm on May 30, 2003 (gmt 0)



Nice! thanks

littleman

8:11 pm on May 30, 2003 (gmt 0)



john@localhost:~$ du -sh ~/work/
59M /home/john/work

That makes Johnny a dull boy.

dingman

9:27 pm on May 30, 2003 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Does that really count when ~/play/ is a project to make something as small as possible? ;)