Spring Fresh Sale! - Up To 67% OFF BDIX Hosting + Free Domain
Linux

How to Check Disk Usage on a Linux Server with df and du

When a Linux server starts running low on space, two commands tell you almost everything you need: df shows how full each disk is, and du shows which folders are eating it. Together they take you from "the disk is full" to "this one log file is the culprit" in about a minute.

You will need SSH access to run these.

Step 1: See how full your disks are with df

Run:

df -h

The -h makes sizes human-readable (GB, MB). Look at the Use% column — anything near 100% is your problem area. The Mounted on column tells you which part of the system it is.

Step 2: Find what is using the space with du

Move into the full area and list the biggest folders:

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

This shows the largest folders directly inside /home, biggest first. Change the path to drill down into whichever folder turns out to be huge, repeating until you find the offender.

Common space-eaters to check

  • Log files in /var/log that were never rotated.
  • Old backups left in a home directory.
  • Email and cached files for busy accounts.
  • Temporary files that a crashed process forgot to clean up.

Once you know what is large, our guide on finding and deleting large files helps you clear it safely.

Frequently asked questions

df says the disk is full but du does not add up. Why?

A deleted file still held open by a running process keeps using space until that process restarts — so du cannot see it but df still counts it. Restarting the responsible service (or the server) usually reclaims it.

Is it safe to delete log files?

Truncating or removing old, rotated logs is generally safe. Do not delete a log a service is actively writing to; instead truncate it or set up proper log rotation so it never grows unbounded.

I am on shared hosting — can I use these?

On shared hosting you check usage through cPanel instead — see understanding your hosting resource usage. The df/du commands are for VPS and dedicated servers where you have full shell access.

Was this article helpful?