0Pricing
Linux Command Line Mastery · Урок

Мониторинг системных ресурсов: `df`, `du`, `free`

Проверяйте свободное место на диске, размеры каталогов и использование памяти, чтобы поддерживать оптимальную работу системы.

«Мониторинг системных ресурсов: `df`, `du`, `free`» — бесплатный урок Linux Command Line Mastery на CoddyKit. Это урок 3 из 4. Ты можешь прочитать весь урок бесплатно ниже — а потом практиковать его прямо в браузере с встроенным редактором кода и ИИ-репетитором 24/7. Это часть пути обучения Linux Command Line Mastery, и твой прогресс синхронизируется между веб-версией и приложением CoddyKit. Курс Linux Command Line Mastery содержит 4 уроков всего.

Части этого урока еще не переведены и отображаются на английском.

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!

Часто задаваемые вопросы

Урок «Мониторинг системных ресурсов: `df`, `du`, `free`» бесплатный?

Да — полный текст урока «Мониторинг системных ресурсов: `df`, `du`, `free`» бесплатно доступен здесь в веб-версии. Чтобы практиковать его интерактивно (встроенный редактор кода и ИИ-репетитор 24/7) и разблокировать остальной курс Linux Command Line Mastery, подпишись на CoddyKit PRO. Курс Linux Command Line Mastery содержит 4 уроков всего.

Чему я научусь в уроке «Мониторинг системных ресурсов: `df`, `du`, `free`»?

Проверяйте свободное место на диске, размеры каталогов и использование памяти, чтобы поддерживать оптимальную работу системы. Ты практикуешь Linux Command Line Mastery с помощью реального кода, который запускаешь прямо в браузере, и ИИ-репетитор 24/7 отвечает на твои вопросы во время урока.

Нужен ли мне опыт, чтобы начать Linux Command Line Mastery?

Предыдущий опыт не требуется. Linux Command Line Mastery на CoddyKit структурирован для всех уровней — от новичков до продвинутых, поэтому ты можешь начать отсюда или с самого начала и учиться в своем темпе. Это урок 3 из 4.

Сколько времени занимает урок «Мониторинг системных ресурсов: `df`, `du`, `free`»?

Большинство уроков CoddyKit занимают около 5–10 минут. Каждый из них компактный и интерактивный, поэтому ты постоянно делаешь прогресс и продолжаешь с того же места в веб-версии и приложении.

Можно ли писать и запускать код в этом уроке Linux Command Line Mastery?

Да. Каждый урок Linux Command Line Mastery включает встроенный редактор кода, поэтому ты пишешь и запускаешь реальный код прямо в браузере и получаешь моментальную обратную связь от AI — локальная установка не требуется.

Все уроки этого курса

  1. Понимание процессов: `ps`, `top`, `htop`
  2. Управление процессами: `kill`, `bg`, `fg`
  3. Мониторинг системных ресурсов: `df`, `du`, `free`
  4. Приоритеты процессов с nice, renice и сигналами
← Назад к Linux Command Line Mastery