Useful Linux commands can help you evaluate disk storage, diagnose disk usage issues and manage disk space effectively. Credit: Gorodenkoff / Shutterstock There are many ways to evaluate disk space usage on Linux, and this post examines a number of commands that allow you to view used and available disk space. Using the df (disk free) command The df command stands for “disk free” and, as that name suggests, it focuses on how much free disk space is used and how much is available. By default, the command reports disk usage in kilobytes. # dfFilesystem 1K-blocks Used Available Use% Mounted ondevtmpfs 4096 0 4096 0% /devtmpfs 1937768 0 1937768 0% /dev/shmtmpfs 775108 1712 773396 1% /runefivarfs 64 23 37 39% /sys/firmware/efi/efivars/dev/sda3 13974528 11385772 1873284 86% //dev/loop0 106496 106496 0 100% /var/lib/snapd/snap/core/16928/dev/loop1 8704 8704 0 100% /var/lib/snapd/snap/gping/13tmpfs 1937768 16 1937752 1% /tmp/dev/sda2 996780 250032 677936 27% /boot/dev/sda1 613160 19484 593676 4% /boot/efi/dev/sda3 13974528 11385772 1873284 86% /hometmpfs 387552 132 387420 1% /run/user/1000tmpfs 387552 44 387508 1% /run/user/1001 Used with the -h option, df reports in the “human-readable” format, adjusting the data to report in megabytes, kilobytes or gigabytes as appropriate. $ df -hFilesystem Size Used Avail Use% Mounted ondevtmpfs 4.0M 0 4.0M 0% /devtmpfs 1.9G 0 1.9G 0% /dev/shmtmpfs 757M 1.7M 756M 1% /runefivarfs 64K 23K 37K 39% /sys/firmware/efi/efivars/dev/sda3 14G 11G 1.8G 86% //dev/loop0 104M 104M 0 100% /var/lib/snapd/snap/core/16928/dev/loop1 8.5M 8.5M 0 100% /var/lib/snapd/snap/gping/13tmpfs 1.9G 16K 1.9G 1% /tmp/dev/sda2 974M 245M 663M 27% /boot/dev/sda1 599M 20M 580M 4% /boot/efi/dev/sda3 14G 11G 1.8G 86% /hometmpfs 379M 132K 379M 1% /run/user/1000tmpfs 379M 44K 379M 1% /run/user/1001 Superuser access is not required to check disk space using the df command unless you need to look into directories for which you don’t have read access. Note that, in the command below, I can ask about george’s home directory, but not about its contents. $ df /home/georgeFilesystem 1K-blocks Used Available Use% Mounted on/dev/sda3 13974528 11385960 1873096 86% /home$ df /home/george/reportdf: /home/george/report: Permission denied The df command with the -T option displays the partition and file system type for the selected directory. $ df -T /homeFilesystem Type 1K-blocks Used Available Use% Mounted on/dev/sda3 btrfs 13974528 11386752 1872304 86% /home Using the du (disk usage) command The du command reports on disk usage but, if you run this command in your home directory, it will report on every file. To view overall disk usage, run a command like this: $ du -sk144200 . The number above represents the size of the current directory. The dot simply represents the current location. A command like that shown below reports the same data. $ du -sk /home/shs144200 /home/sh Notice that using the -sk options, you also don’t see details on subdirectories. $ du bin12 bin/NOTES24 bin$ du -sk bin24 bin Superuser access is required if you want to report on directories for which you don’t have adequate permission. # du -sk *24 cookie16 dumdum431784 fedora32 george48 lola16 newuser144200 shs Like df, du has an option for the “human-readable” format. $ du -h bin12K bin/NOTES24K bin Use the du -sh command to show the size of your current directory. $ du -sh .141M . Directories for which you don’t have read access will be obvious and the sum shown will not reflect their contents. The last line in the output below lists the size of the current directory. $ cd /home; du -sh .du: cannot read directory './fedora': Permission denieddu: cannot read directory './newuser': Permission denieddu: cannot read directory './george': Permission denieddu: cannot read directory './lola': Permission denieddu: cannot read directory './dumdum': Permission denieddu: cannot read directory './cookie': Permission denied141M . A command like that below will display disk usage for the largest files or directories in the current file system location. $ du -ah /home/shs | sort -rh | head -n 5141M /home/shs115M /home/shs/.cache48M /home/shs/.cache/gnome-software46M /home/shs/.cache/mozilla/firefox/c8n9kgaz.default-release46M /home/shs/.cache/mozilla/firefox Using the ls command The ls command generally lists files by name, but it can also display files in size order with the -lhS options. $ ls -lhS | head -5total 708K-rw-r--r--. 1 shs shs 3.9K Nov 8 2023 bash_builtins-rw-r--r--. 1 shs shs 2.5K Nov 17 2023 AllTablesdrwxr-xr-x. 1 shs shs 1.9K Jan 2 12:38 videos-rwx------. 1 shs shs 1.7K Nov 27 2023 buildTable And don’t forget that you can turn commands like this into aliases to make them easier to use. $ alias bysize="ls -lhS" Using the fdisk command The fdisk command can provide useful stats on your disk partitions. Here’s an example: $ sudo fdiskfdisk: bad usageTry 'fdisk --help' for more information.$ sudo fdisk -lDisk /dev/sda: 14.91 GiB, 16013942784 bytes, 31277232 sectorsDisk model: KINGSTON SNS4151Units: sectors of 1 * 512 = 512 bytesSector size (logical/physical): 512 bytes / 512 bytesI/O size (minimum/optimal): 512 bytes / 512 bytesDisklabel type: gptDisk identifier: 818C0FC9-CBBA-49E5-953B-A511A4E40A3DDevice Start End Sectors Size Type/dev/sda1 2048 1230847 1228800 600M EFI System/dev/sda2 1230848 3327999 2097152 1G Linux filesystem/dev/sda3 3328000 31277055 27949056 13.3G Linux filesystemDisk /dev/zram0: 3.7 GiB, 3967811584 bytes, 968704 sectorsUnits: sectors of 1 * 4096 = 4096 bytesSector size (logical/physical): 4096 bytes / 4096 bytesI/O size (minimum/optimal): 4096 bytes / 4096 bytesDisk /dev/loop0: 103.99 MiB, 109043712 bytes, 212976 sectorsUnits: sectors of 1 * 512 = 512 bytesSector size (logical/physical): 512 bytes / 512 bytesI/O size (minimum/optimal): 512 bytes / 512 bytesDisk /dev/loop1: 8.44 MiB, 8847360 bytes, 17280 sectorsUnits: sectors of 1 * 512 = 512 bytesSector size (logical/physical): 512 bytes / 512 bytesI/O size (minimum/optimal): 512 bytes / 512 bytes Using the lsblk command The lsblk command provides very useful information on your disk partitions. The output shown below clearly shows that the disk (sda) had three partitions and their sizes and mount points. $ lsblkNAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINTSloop0 7:0 0 104M 1 loop /var/lib/snapd/snap/core/16928loop1 7:1 0 8.4M 1 loop /var/lib/snapd/snap/gping/13sda 8:0 0 14.9G 0 disk├─sda1 8:1 0 600M 0 part /boot/efi├─sda2 8:2 0 1G 0 part /boot└─sda3 8:3 0 13.3G 0 part /home /zram0 252:0 0 3.7G 0 disk [SWAP] Wrap-up These commands described in this post can help you evaluate disk storage, diagnose disk usage issues and manage disk space effectively.Related reading: Linux commands for managing, partitioning, troubleshooting Examining partitions on Linux systems How to use the fdisk command How to use the du command Tracking disk space usage SUBSCRIBE TO OUR NEWSLETTER From our editors straight to your inbox Get started by entering your email address below. Please enter a valid email address Subscribe