Tuesday, 10 January 2017

How to check disk space usage on Ubuntu


This article i will show you how to check disk space usage on ubuntu via command line, there is a special program that can do this, a command line tool called 'df' can show you disk space usage on ubuntu.

You can check your disk space usage by running 'df' on the command line, like this:
df
kernelpanic@ubuntu16:~$ df
Filesystem 1K-blocks Used Available Use% Mounted on
/dev/sda2 952583092 875410860 28760740 97% /
none 4 0 4 0% /sys/fs/cgroup
udev 4050676 4 4050672 1% /dev
tmpfs 812296 1380 810916 1% /run
none 5120 0 5120 0% /run/lock
none 4061460 82780 3978680 3% /run/shm
none 102400 48 102352 1% /run/user
/dev/sda1 523248 3428 519820 1% /boot/efi
The output above is hard to read, specially on the 'Used' and 'Available' part, because that's the part that most important for us to know.

By default 'df' will show the number in bytes, but we can tell 'df' to output in GB or MB format, to show in GB format, simply add parameter -h, 'h' stand for 'human readable' format.
df -h
kernelpanic@ubuntu16:~$ df -h
Filesystem Size Used Avail Use% Mounted on
/dev/sda2 909G 835G 28G 97% /
none 4.0K 0 4.0K 0% /sys/fs/cgroup
udev 3.9G 4.0K 3.9G 1% /dev
tmpfs 794M 1.4M 792M 1% /run
none 5.0M 0 5.0M 0% /run/lock
none 3.9G 95M 3.8G 3% /run/shm
none 100M 48K 100M 1% /run/user
/dev/sda1 511M 3.4M 508M 1% /boot/efi

To output in MB format, you can add parameter -m, like this:
df -m
Lastly if you just want a specific place to be output, you can do something like this:
df -h /
kernelpanic@ubuntu16:~$ df -h /
Filesystem Size Used Avail Use% Mounted on
/dev/sda2 909G 835G 28G 97% /

Harry

Author & Editor

A technology enthusiast and addictive blogger who likes to hacking tricks and wish to be the best White Hacket Hacker of the World.

0 comments:

Post a Comment

Note: only a member of this blog may post a comment.