How To View Free Disk Space And Disk Usage From The Linux Terminal

Managing storage space is one of the most important parts of maintaining any Linux system. Whether you are running a desktop PC, a server, a virtual machine, or even a Raspberry Pi, understanding how to check free disk space and analyze disk usage from the terminal is essential. Linux provides several powerful built-in command-line tools that allow users to inspect storage devices, monitor available space, identify large files or directories, and troubleshoot storage issues efficiently.

For system administrators, developers, and even casual Linux users, mastering disk space commands can help prevent system crashes, optimize storage, and maintain healthy performance. Running out of disk space can cause software failures, package installation errors, log file problems, or even prevent Linux from booting properly.

Update Windows Drivers

This detailed guide explains how to check free disk space, monitor partition usage, analyze directory sizes, locate large files, automate disk monitoring, and troubleshoot common storage issues directly from the Linux terminal.

Why Monitoring Disk Space Matters in Linux

PC running slow or unstable? Do you want to update drivers?

Disk storage is used by:

  • Operating system files
  • User files
  • Installed applications
  • Logs
  • Databases
  • Temporary files
  • Swap space
  • Backups
  • Containers and virtual machines

If storage becomes full, users may experience:

  • Package manager failures
  • System slowdowns
  • Application crashes
  • Log write failures
  • Database corruption
  • Update issues
  • Boot problems

Regular disk monitoring helps:

  • Prevent storage shortages
  • Improve performance
  • Clean unnecessary files
  • Detect runaway logs
  • Manage backups
  • Optimize server reliability

Basic Linux Storage Concepts

Before checking disk space, it is important to understand Linux storage terminology.

Filesystem

A method Linux uses to organize files, such as:

  • ext4
  • xfs
  • btrfs
  • zfs
  • ntfs
  • fat32

Partition

A section of a disk.

Mount Point

Repair PC

A directory where a partition is attached.

Examples:

  • /
  • /home
  • /boot
  • /var

Block Device

PC running slow or unstable? Do you want to update drivers?

Physical or virtual storage device:

  • /dev/sda
  • /dev/nvme0n1

The df Command – Check Free Disk Space

The most common command for viewing available disk space is:

df

What it shows:

  • Mounted filesystems
  • Total space
  • Used space
  • Available space
  • Usage percentage
  • Mount points

Example output:

Filesystem      Size  Used Avail Use% Mounted on
/dev/sda1 100G 40G 55G 43% /

Using Human-Readable Format

For easier reading:

df -h

Benefits:

  • Displays MB, GB, TB
  • Easier interpretation

Example:

Filesystem      Size  Used Avail Use% Mounted on
/dev/sda1 100G 40G 55G 43% /

Show Specific Filesystem Type

df -Th

Adds:

  • Filesystem type column

Useful for identifying:

  • ext4
  • xfs
  • tmpfs
  • overlay

Checking Inodes Instead of Space

Sometimes disk space is available, but inode exhaustion prevents file creation.

df -i

Inodes represent:

  • File count limits
PC running slow or unstable? Do you want to update drivers?

If inodes are full:

  • Cannot create new files

The du Command – Disk Usage Analysis

While df checks partition space, du checks file and directory sizes.

Basic usage:

du

This lists sizes recursively.

Human-readable summary:

du -sh

Common example:

du -sh /home

This shows total size of /home.

Viewing Subdirectory Sizes

du -h --max-depth=1 /home

Useful for:

  • Finding large user folders
  • Locating storage hogs

Sorting Largest Directories

du -h --max-depth=1 / | sort -hr

Benefits:

  • Lists largest directories first
  • Quickly identifies major storage consumers

Finding Large Files

find / -type f -size +1G

This finds:

  • Files larger than 1GB

Modify size:

  • +500M
  • +100M

Useful for:

  • Old backups
  • ISO files
  • Logs
  • Virtual disks

The ls Command for File Sizes

To list files by size:

ls -lh

Sort by size:

ls -lhS

Benefits:

  • Quick local inspection

The ncdu Tool – Interactive Disk Usage Viewer

ncdu provides a user-friendly terminal interface.

Install:

Ubuntu/Debian:

sudo apt install ncdu

Fedora:

sudo dnf install ncdu

Arch:

sudo pacman -S ncdu

Run:

ncdu /

Features:

  • Interactive navigation
  • Easy deletion
  • Fast scanning
  • Excellent for troubleshooting

Checking Block Devices with lsblk

lsblk

Shows:

  • Drives
  • Partitions
  • Sizes
  • Mount points

Human-readable:

lsblk -f

Useful for:

  • USB drives
  • SSDs
  • NVMe
  • External storage

Using fdisk for Disk Details

sudo fdisk -l

Shows:

  • Full partition tables
  • Sizes
  • Disk labels
  • Sector information

Monitoring Mounted Storage

mount

Or:

findmnt

Checking Swap Usage

swapon --show

Or:

free -h

Analyzing Log File Growth

Large logs often consume disk unexpectedly.

Check logs:

du -sh /var/log

Largest log files:

find /var/log -type f -exec du -h {} + | sort -hr | head

Cleaning Package Cache

Ubuntu/Debian:

sudo apt clean

Fedora:

sudo dnf clean all

Arch:

sudo pacman -Scc

Removing Old Kernels

Old kernels can waste storage.

Ubuntu:

sudo apt autoremove

Monitoring Docker Disk Usage

Containers can consume large space.

docker system df

Cleanup:

docker system prune

Monitoring Disk Usage by User

du -sh /home/*

Useful for:

  • Shared servers
  • Hosting environments
  • Multi-user systems

Automating Disk Space Alerts

Basic shell script:

df -h | grep '^/dev/'

Advanced admins can combine with:

  • cron
  • email alerts
  • monitoring tools
  • 70% = Monitor
  • 80% = Warning
  • 90%+ = Critical

Common Storage Problem Areas

/var

  • Logs
  • Databases
  • Cache

/home

  • Downloads
  • Videos
  • Backups

/tmp

  • Temporary files

Docker/VM images

  • Extremely large growth

Understanding Reserved Space

Linux filesystems often reserve ~5% for root.

View with:

sudo tune2fs -l /dev/sda1 | grep Reserved

Adjust:

sudo tune2fs -m 1 /dev/sda1

Cloud and Server Considerations

On servers, monitor:

  • Database growth
  • Logs
  • Email queues
  • Snapshots
  • Backups
  • Container storage

Best Practices for Disk Management

  • Regularly monitor with df -h
  • Analyze with du
  • Use ncdu
  • Rotate logs
  • Clean caches
  • Remove unused software
  • Maintain backups
  • Monitor Docker
  • Watch inode usage

Troubleshooting “No Space Left on Device”

Even if df shows space:

Check:

  • Inodes (df -i)
  • Deleted open files:
lsof | grep deleted

Fix:

  • Restart offending service
  • Reboot if necessary

GUI Alternatives (Optional)

While terminal tools are powerful, Linux desktop users may also use:

  • GNOME Disk Usage Analyzer
  • KDE Filelight
  • Baobab

However, terminal tools are faster, scriptable, and universal.

Advanced Tools

iotop

Monitors disk activity.

smartctl

Checks drive health.

parted

Advanced partition management.

btrfs filesystem usage

For Btrfs systems.

Final Thoughts

Viewing free disk space and disk usage from the Linux terminal is an essential skill for every Linux user. Commands like df, du, lsblk, find, and ncdu provide complete control over storage management, allowing you to quickly inspect available space, locate large files, monitor partitions, and troubleshoot disk-related problems.

Whether you are maintaining a home Linux PC, managing enterprise servers, or running cloud infrastructure, these tools help ensure your system remains stable, efficient, and free from dangerous storage shortages.

By regularly checking storage, cleaning unnecessary files, and understanding where your disk space is being used, you can prevent many common Linux performance and stability issues before they become serious problems.

FAQs

What command checks free disk space in Linux?

Use:

df -h

How do I check folder size?

Use:

du -sh foldername

How do I find large files?

Use:

find / -type f -size +1G

What is the best interactive disk analyzer?

ncdu is one of the best terminal-based tools.

Why does Linux say no space left when space exists?

Often inode exhaustion or deleted-but-open files are the cause.

PC running slow or unstable? Do you want to update drivers?

GeeksDigit.Com
Logo