DCubes
Linux module

Lesson 11

What's running, what's full

df, du, free, and a first look at processes — disk full and out of memory.

beginner25 minRun on your machine

What you will be able to do

  • Check free disk with df and a folder's size with du
  • Read a memory summary on Linux
  • Recognize disk-full and out-of-memory as the two classic failures

Why this matters for DE and AI

Two errors will dominate your on-call years:

  1. No space left on device — downloads, Spark spill, Hugging Face caches, Docker images, log files that grew without bound.
  2. Out of memory (OOM) — training batch too large, Spark executor too small, a notebook that loaded a “small” CSV that was not small.

You fix both by looking at the machine, not the Python traceback first.

Concepts

Command Use
df -h Disk free, human-readable (G, M)
du -sh FOLDER Disk usage of one folder, summary
free -h Memory on Linux (WSL included)
ps A snapshot of processes
ps aux More detail (Linux/macOS)

top and htop are live monitors. Optional. If top is running, press q to quit.

macOS: df -h and du -sh work. free -h does not. Use Activity Monitor, or skip the memory command.

You are only looking in this lesson. Do not kill processes. Do not delete system folders.

Practice on your machine

df -h

What you should see: a table of filesystems. Look at Avail (or Available) and Use% for the row that mounts on / or /Users. If usage is 95%+, you will have problems soon. WSL uses a virtual disk; it can fill independently of Windows.

du -sh ~/dcubes/linux-lab
du -sh ~/dcubes/linux-lab/*

What you should see: a tiny size (likely kilobytes). After real datasets this command is how you find which directory ate the disk.

Linux / WSL:

free -h

Look at Mem and the available column. Swap is overflow disk used as extra memory — slow, and a warning sign on GPU boxes.

ps

A short list, mostly your shell. Optional:

ps aux | head

If the output is wide and confusing, that is normal. You only need the idea: programs are processes; they use CPU, memory, and sometimes GPU.

Common mistakes

  • Deleting /tmp blindly, or anything under /usr. If disk is full, start with du -sh on directories you created: home, project folders, ~/.cache.
  • Ignoring disk on GPU machines. Model weights and datasets hide in caches. Same du skill.
  • Leaving top running and thinking the terminal is frozen. Press q.

Next

Installing software safely — apt, Homebrew, and why we never pipe curl into sudo.