Linux supports the following commands to find out how to check and reduce disk usage in Linux.

The following command can be used to find out how to check and reduce disk usage in Linux.

df command – To Display the measure of disk space utilized and accessible on Linux file systems.
du command – Shows the measure of disk space utilized by the specified documents and for every subdirectory.
btrfs fi df /device/ – Show disk space use data for a btrfs based mount point/file system.

Different Commands using df to find disk space

1. To find the Disk usage of a file system.

$ df
Filesystem 1K-blocks Used Available Use% Mounted on
devtmpfs 499756 56 499700 1% /dev
tmpfs 508684 0 508684 0% /dev/shm
/dev/xvda1 15348700 5538860 9709592 37% /

2. To find all File System’s Disk Space Usage

$ df -a
Filesystem 1K-blocks Used Available Use% Mounted on
proc 0 0 0 – /proc
sysfs 0 0 0 – /sys
devtmpfs 499756 56 499700 1% /dev
devpts 0 0 0 – /dev/pts
tmpfs 508684 0 508684 0% /dev/shm
/dev/xvda1 15348700 5538860 9709592 37% /
devpts 0 0 0 – /dev/pts
none 0 0 0 – /proc/sys/fs/binfmt_misc

3. To view the results in Human Readable Format

$ df -h
Filesystem Size Used Avail Use% Mounted on
devtmpfs 489M 56K 488M 1% /dev
tmpfs 497M 0 497M 0% /dev/shm
/dev/xvda1 15G 5.3G 9.3G 37% /

4. To find the usage of a specific File System (Eg:- /home)

# df -hT /home
Filesystem Type Size Used Avail Use% Mounted on
/dev/vdb1 ext4 296G 176G 105G 63% /home

5. To find the information in MB statistics.

$ df -m
Filesystem 1M-blocks Used Available Use% Mounted on
devtmpfs 489 1 488 1% /dev
tmpfs 497 0 497 0% /dev/shm
/dev/xvda1 14989 5410 9483 37% /

6. To find out the usage of inodes and their percentage.

$ df -i
Filesystem Inodes IUsed IFree IUse% Mounted on
devtmpfs 124939 428 124511 1% /dev
tmpfs 127171 1 127170 1% /dev/shm
/dev/xvda1 983040 98363 884677 11% /

7. To include Certain types of File System in the results

df -t ext3
Filesystem 1K-blocks Used Available Use% Mounted on
/dev/mapper/storage-root
922322860 364004136 511467448 42% /

8. To remove Certain File System Type from the results

df -x ext3
Filesystem 1K-blocks Used Available Use% Mounted on
tmpfs 16236436 8520 16227916 1% /dev/shm
/dev/md0 198273 128188 59849 69% /boot

To discover where disk space is being utilized:

1. Go to the root directory by using the command cd /

2. Execute sudo du -h –max-depth=1

3. Mark the directories which are using high disk space.

4. ‘cd’ <directory>

5. Run ls -l to find out which all files are using high space. Delete unwanted files.

6. Repeat steps two to five.

ServerAdminz provides Outsourced 24/7 Technical Support, Remote Server Administration, Server Security, Linux Server Management, Windows Server Management and Helpdesk Management to Data centers, Hosting companies and ISPs around the world. We specialize in Extended Server Security, Server Hardening, Support of Linux/UNIX/Windows servers, products and services.

ServerAdminz is a server support company specialized in Outsourced 24/7 Web Hosting Support, Remote Infrastructure Management, NOC, Cloud and Enterprise Security Services. With over 10+ of years of experience in working with major Data Centers and ISPs with 130+ experienced technicians, we continue to manage more than 49,000 servers from 85+ countries and has bagged 5 international awards.

If you have any queries on how to check and reduce disk usage in Linux, share your thoughts and our representative will get back to you.
[one_full last=”yes” spacing=”yes” center_content=”no” hide_on_mobile=”no” background_color=”” background_image=”” background_repeat=”no-repeat” background_position=”left top” border_position=”all” border_size=”0px” border_color=”” border_style=”solid” padding=”” margin_top=”” margin_bottom=”” animation_type=”0″ animation_direction=”down” animation_speed=”0.1″ class=”” id=””]

[/one_full]