0Pricing
Linux Command Line Mastery · Lesson

Monitoring System Resources: `df`, `du`, `free`

Check disk space, directory sizes, and memory usage to keep your system optimized.

Monitoring System Resources: `df`, `du`, `free` is a free Linux Command Line Mastery lesson on CoddyKit — lesson 3 of 4. You can read the complete lesson below for free — then practise it hands-on in the browser with a built-in code editor and a 24/7 AI tutor. It is part of the Linux Command Line Mastery learning path, one of 4 lessons in the course, and your progress syncs across the web and the CoddyKit app.

Why Monitor System Resources?

Keeping an eye on your system's resources is crucial for smooth operation. Just like a car needs fuel and oil, your computer needs enough disk space and memory to run efficiently.

Ignoring these can lead to slow performance, crashes, or even data loss.

Check Disk Space with `df`

The df command, short for "disk free", reports the amount of available disk space used by file systems.

It's your go-to command to see how much room is left on your partitions.

`df` Command in Action

Let's try df with the -h option for human-readable output. This makes sizes like gigabytes (GB) and megabytes (MB) easy to understand.

Run this command in your terminal:

df -h

Interpreting `df` Results

The output of df -h shows several columns:

  • Filesystem: The name of the disk partition.
  • Size: Total capacity of the partition.
  • Used: Space currently occupied.
  • Avail: Remaining free space.
  • Use%: Percentage of disk space used.
  • Mounted on: Where the filesystem is accessible in the directory tree.

Disk Usage with `du`

While df shows overall disk free space, du ("disk usage") estimates file space usage, primarily for specific files or directories.

It helps you find out which folders are taking up the most space.

`du` on a Directory

To see the total size of a directory in a human-readable format, use -s (summary) and -h (human-readable) with du. Replace /var/log with any directory you want to check.

du -sh /var/log

Detailed `du` Output

Want to see the size of subdirectories within a folder? Use --max-depth=N to limit the depth of the output. Here, we'll see direct subdirectories (depth 1).

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

Monitor Memory with `free`

Memory (RAM) is vital for your system's speed. The free command displays the total amount of free and used physical and swap memory in the system.

Keeping an eye on free memory helps prevent slowdowns.

`free -h` in Practice

Similar to df, using the -h option with free provides output that's much easier to read. It shows memory in KB, MB, or GB.

free -h

Resource Monitoring Check

You're running low on disk space and want to find which large directories are consuming it. Which command is best suited for this task?

Recap: System Resources

Great job! In this lesson, you learned how to monitor your Linux system's vital resources:

  • df: Check overall disk free space.
  • du: Estimate disk usage for files and directories.
  • free: Monitor physical and swap memory usage.

These commands are essential tools for maintaining a healthy and optimized system!

Frequently asked questions

Is the “Monitoring System Resources: `df`, `du`, `free`” lesson free?

Yes — the full text of “Monitoring System Resources: `df`, `du`, `free`” is free to read here on the web, and the Linux Command Line Mastery course includes 4 lessons in total. To practise it interactively (a built-in code editor and a 24/7 AI tutor) and unlock the rest of the Linux Command Line Mastery course, upgrade to CoddyKit PRO.

What will I learn in “Monitoring System Resources: `df`, `du`, `free`”?

Check disk space, directory sizes, and memory usage to keep your system optimized. You practise Linux Command Line Mastery with hands-on code you run directly in the browser, and a 24/7 AI tutor answers your questions as you work through the lesson.

Do I need any experience to start Linux Command Line Mastery?

No prior experience is required. Linux Command Line Mastery on CoddyKit is structured for beginners through advanced learners; this is — lesson 3 of 4, so you can start here or from the beginning and move at your own pace.

How long does the “Monitoring System Resources: `df`, `du`, `free`” lesson take?

Most CoddyKit lessons take about 5–10 minutes. Each one is bite-sized and interactive, so you make steady progress and pick up exactly where you left off across the web and the app.

Can I write and run code in this Linux Command Line Mastery lesson?

Yes. Every Linux Command Line Mastery lesson includes a built-in code editor, so you write and run real code right in your browser and get instant AI feedback — no local setup required.

All lessons in this course

  1. Understanding Processes: `ps`, `top`, `htop`
  2. Managing Processes: `kill`, `bg`, `fg`
  3. Monitoring System Resources: `df`, `du`, `free`
  4. Process Priorities with nice, renice, and Signals
← Back to Linux Command Line Mastery