2 min read

Команды Linux для работы с процессами

~$ pkill

Находит путь к программе.

List running processes in Linux

Use one of the three commands to list processes in Linux:

  • ps – displays a list of all processes; it can also be used with options to get a more detailed output.
  • top – displays a live list of currently active processes and allows you to interact with them by killing, stopping, changing priority, and so on.
  • htop – instantaneous results on a user-friendly output with the opportunity to engage with the process
💡
В отличие от df, команда du фокусируется на каталогах, занимающих пространство, а команда df фокусируется на конкретных дисках и пространстве, которое они используют.

Utilizing ps as a command

The ps command (process statuses) creates a snapshot of all currently active processes. As a result, unlike the Windows task manager, the outcomes are predictable.

The syntax for the ps command is as follows:

ps [options]

The following are some of the most commonly used ps command options:

  • a: Make a list of all processes that are causing problems for all users.
  • -A, -e: Display a list of all the processes on the system.
  • -a: List all processes, excluding session leaders (those whose process ID is the same as the session * ID) and those not associated with a terminal.
  • -d: Except for session leaders, list all processes.
  • –deselect, - N: Remove any processes that do not meet a user-defined condition from the list.
  • f: Uses ASCII art to display the process hierarchy.
  • -j: Shows the output in jobs format.
  • T: Make a list of all the processes that are connected to this terminal.
  • r: Only list processes that are currently active.
  • u: Increase the size of the output to include more information, such as CPU and memory use.
  • -u: Define a user for whom you want to list processes.
  • x: Processes without a TTY are included.

Running the ps command without any options produces an output similar to

The following categories are included in the default output:

  • PID: Process Identification Number
  • TTY: The terminal on which the process is operating.
  • TIME: The total amount of time spent on the computer (CPU usage total amount).
  • CMD: The name of the command that started the process

Using the a, u, and x options together produces a more detailed output

ps aux

The extended output now includes the following new categories:

  • USER: This is the name of the person who is executing the process.
  • %CPU: The proportion of time that the CPU is in use.
  • %MEM: The proportion of memory used.
  • VSZ: The process’s total virtual memory usage in kilobytes.
  • RSS: “stands for Resident Set Size”, which refers to the amount of RAM used by a process.
  • STAT: The current state of the process.
  • START: The time when the process began.

To show the currently executing processes in a hierarchical order.

ps -axjf

Using the top command in Linux, you can get a list of currently running processes


В Linux есть две