df, du and tree in Linux
The 'df' command is the simplest tool to view disk usage. Using it without any switches will display the result in block of usage which is not understandable especially for home users. Use the '-h' switch to make it human readable form i.e. the displayed disk usage will be in Megabytes, Kilobytes or Gigabytes. To check the inode usage use '-i' switch.
Filesystem |
Size |
Used |
Avail |
Use% |
Mounted on |
|
|
|
|
|
|
/dev/hda7 |
996M |
525M |
420M |
56% |
/ |
/dev/hda2 |
3.0G |
1.1G |
1.8G |
39% |
/anup |
/dev/hda6 |
99M |
9.2M |
85M |
10% |
/boot |
/dev/shm |
236M |
0 |
236M |
0% |
/dev/shm |
/dev/hda8 |
487M |
11M |
451M |
3% |
/home |
/dev/hda10 |
996M |
35M |
910M |
4% |
/tmp |
/dev/hda12 |
7.2G |
3.6G |
3.3G |
53% |
/usr |
/dev/hda11 |
996M |
157M |
787M |
17% |
/var |
The 'du' show file and directory usage otherwise it is much similar to the 'df' command. By using again the command without the switch can be grasped only by a hi-fi system admin working on over five hundred server machines. To make it understandable use 'du -h /foldername'. If you have tried this command along with us, then you know it shows a recursive output digging into every file and folder under the folder name your have specified. To avoid recursive output and obtain just the file size of the single directory or folder issue 'du - hs/directory'.
/root@amuk etc/# du -hs/digit/
1.1G /digit
The tree command is not unique to Linux. It was there in MS -DOS too, but Microsoft discontinued it in Windows. This command gives a diagrammatic representation of the directory structure much like the pstree command..
Thanks for reading..
0 Comment(s)