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
- How full is it?.
dfshows each filesystem and how much of it is used.-hgives readable sizes, such as21G, rather than a count of blocks. - What's in this folder?.
duadds up what a folder uses.-sgives one total, and-hmakes it readable. - Biggest last.
--max-depth=1shows one level of folders. Pipe it intosort -h, which understands sizes such as2Gand640M, and the biggest ends up at the bottom, right above your prompt. - See the files.
ls -lhshows file sizes in the same readable way. Now you can see exactly what's taking the room. - 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.