0Pricing
Linux Command Line Mastery · Урок

Понимание процессов: `ps`, `top`, `htop`

Изучите команды для просмотра, мониторинга и анализа активных процессов в вашей системе Linux.

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

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

What Are Processes?

Welcome! In this lesson, we'll explore how to view and monitor programs running on your Linux system. These running programs are called processes.

Understanding processes is crucial for system administration, troubleshooting, and managing resource usage.

`ps`: Snapshot of Processes

The simplest way to see active processes is with the ps command. It gives you a snapshot of current processes.

By default, ps shows processes owned by your user in the current terminal session.

ps

More `ps` Details: `aux` and `-ef`

To see all processes on the system, including those owned by other users and system processes, we use options like aux or -ef.

  • a: Show processes for all users.
  • u: Display user/owner.
  • x: Show processes without a controlling terminal.

The -ef option is a common alternative on some systems, providing similar comprehensive output.

ps aux

Deciphering `ps` Output

When you run ps aux, you'll see several columns:

  • USER: The owner of the process.
  • PID: The unique Process ID.
  • %CPU: CPU usage percentage.
  • %MEM: Memory usage percentage.
  • CMD: The command that started the process.

These details help you identify what's running and by whom.

PID and PPID Explained

Every process has a unique PID (Process ID). It's like a social security number for a process.

Many processes are started by other processes. The process that starts another is called its parent process. The child process will have a PPID (Parent Process ID) that matches the parent's PID.

This creates a process tree, showing how processes are related.

ps -o pid,ppid,cmd

`top`: Real-time Monitoring

While ps gives a snapshot, top provides a dynamic, real-time view of your system's processes.

It continuously updates, showing CPU and memory usage, uptime, and a list of processes sorted by CPU usage (by default).

This is great for spotting processes consuming a lot of resources.

top

Navigating `top`

top is interactive! Here are some basic keys:

  • Press q to quit.
  • Press M to sort processes by memory usage.
  • Press P to sort processes by CPU usage (default).
  • Press k to "kill" a process (you'll need the PID).

Remember to be careful when using k!

`htop`: An Enhanced `top`

htop is an improved, interactive process viewer that's often preferred over top due to its user-friendliness.

It offers a more colorful and intuitive interface, making it easier to see CPU and memory usage visually.

You might need to install it first (e.g., sudo apt install htop on Debian/Ubuntu).

htop

Why Use `htop`?

htop provides several advantages:

  • Visual Bars: Clear graphs for CPU, memory, and swap.
  • Scrolling: Easily scroll horizontally and vertically.
  • Mouse Support: Click to sort columns or select processes.
  • Easy Filtering/Searching: Quickly find specific processes.
  • Tree View: See process hierarchy clearly.

It's a powerful tool for monitoring system health.

Process Command Check

You've learned about ps, top, and htop. Let's see if you can distinguish their primary uses.

Processes: Snapshot vs. Real-time

Great job! You now understand how to monitor processes on Linux.

  • ps: Gives a static snapshot of processes. Use ps aux or ps -ef for comprehensive lists.
  • top: Provides a real-time, interactive view of processes, sorted by resource usage.
  • htop: An enhanced, more user-friendly version of top with visual bars, mouse support, and easier navigation.

These tools are essential for any Linux user!

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

Урок «Понимание процессов: `ps`, `top`, `htop`» бесплатный?

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

Чему я научусь в уроке «Понимание процессов: `ps`, `top`, `htop`»?

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

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

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

Сколько времени занимает урок «Понимание процессов: `ps`, `top`, `htop`»?

Большинство уроков 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