PPRuNe Forums - View Single Post - Linux Corner
Thread: Linux Corner
View Single Post
Old 7th Oct 2010, 14:22
  #376 (permalink)  
LH2
 
Join Date: May 2005
Location: Abroad
Posts: 1,172
Likes: 0
Received 0 Likes on 0 Posts
The quick and dirty way, preferably as root:

du -csh /* 2>/dev/null

Example output:

8.3M /bin
23M /boot
264K /dev
41M /etc
73G /home
156M /lib
23M /lib64
16K /lost+found
4.0K /media
4.0K /mnt
4.0K /opt
0 /proc
1.6M /root
12M /sbin
4.0K /selinux
214G /srv
0 /sys
728M /tftpboot
6.0M /tmp
3.4G /usr
20G /var
311G total


Then repeat as needed on any subdirectories of interest, e.g.,:

du -csh /var/* 2>/dev/null
61M /var/adm
50M /var/cache
4.0K /var/crash
4.0K /var/games
20G /var/lib
32K /var/lock
79M /var/log
0 /var/mail
4.0K /var/opt
372K /var/run
99M /var/spool
17M /var/tmp
4.0K /var/X11R6
12K /var/yp
20G total


An alternative syntax to have the output appear in order of decreasing size:

du -s /var/* 2>/dev/null |sort -nr
20403992 /var/lib
100660 /var/spool
80352 /var/log
61476 /var/adm
51000 /var/cache
17360 /var/tmp
372 /var/run
32 /var/lock
12 /var/yp
4 /var/X11R6
4 /var/opt
4 /var/games
4 /var/crash
0 /var/mail


Various graphical tools are also available, but I always use the above as it's guaranteed to be on any Linux installation (some embedded platforms excepted).
LH2 is offline