Skip to content
ohsudo, Home

Module 4: The system

Disk space: df and du

A full disk breaks databases, logs and logins. Two commands answer the two questions you'll have: how full is it, and what's using it?

● Runs 100% in your browser. Nothing here can harm a real system.

Step 1 of 5

How full is it?

df shows each filesystem and how much of it is used. -h gives readable sizes, such as 21G, rather than a count of blocks.

Your task

Show how full the disks are.

guest@ohsudo: ~ — Ubuntu 24.04

Starting the terminal…

What you'll practice

  1. How full is it?. df shows each filesystem and how much of it is used. -h gives readable sizes, such as 21G, rather than a count of blocks.
  2. What's in this folder?. du adds up what a folder uses. -s gives one total, and -h makes it readable.
  3. Biggest last. --max-depth=1 shows one level of folders. Pipe it into sort -h, which understands sizes such as 2G and 640M, and the biggest ends up at the bottom, right above your prompt.
  4. See the files. ls -lh shows file sizes in the same readable way. Now you can see exactly what's taking the room.
  5. Free some space. Files you've downloaded yourself are the safest things to remove. A file on a server may be in use, so check what it is first.

See also