Tuesday, April 1, 2008

HowTo: Get Disk, Partition And Folder Space Usage

Quick and brief.

Here's a swift blog entry on how to retrieve and get disk usage of the following items:

a. directory folder
b. mounted disk partition
c. disk

To get the disk usage of a folder and return a human readable summarized usage

# du -sh /folder1
# du -sh /folder1/folder2
# du -sh /folder1 /folder2


To get the disk usage of a mounted partition

# du -sh /mnt/windows
# du -sh /mnt/ISO
# du -sh /mnt/USB


To get the disk usage of each folder on current working directory

# du -sh .

To get the disk usage of a folder excluding specific files, like excluding all MP3 files.

# du -sh /folder1/folder2 --exclude='*.mp3'
# du -sh /folder1 --exclude='*.jpg'


To get the disk usage of disk partition or mounted partition

# df -ah
# df -ah /dev/sda1
# df -ah /dev/sda1 /dev/sda2


To get the default partition usage where a system user belongs to
# df -ah ~username

The above shows the total usage of the partition where the user's default home partition belongs to.

That is all. Enjoy.


Related Articles:
More Disk Usage on Linux
Monitoring Large MailBox Users
Linux Resource Monitoring Tool
Disk Report Usage Tool
Harddisk Monitoring Linux Tool
Watching How Linux Log File Grows

0 comments:

Sign up for PayPal and start accepting credit card payments instantly.
ILoveTux - howtos and news | About | Contact | TOS | Policy