4 ways to view processes in LINUX (summary)

4 ways to view processes in LINUX (summary)

A process is a program code that runs in the CPU and memory, and each process can create one or more processes (parent and child processes).

**View process method:**

The first one:

ps aux

The ps command is used to report the process status of the current system. You can use the kill command to interrupt and delete unnecessary programs at any time. The ps command is the most basic and also very powerful process viewing command. This command can be used to determine which processes are running and their running status, whether the processes have ended, whether the processes are dead, which processes are occupying too many resources, etc. In short, most of the information can be obtained by executing this command.

a: Display all process information under the current terminal, including processes of other users.

u: Output process information in user-centric format.

x: Display the processes of the current user in all terminals.

Example:

**Explanation of the fields in the above figure:**

USER: The name of the user account that started the process
PID: The ID number of the process, which is unique in the current system
%CPU: The percentage of CPU usage
%MEM: Percentage of memory used

VSZ: The size of virtual memory (swap space) occupied
RSS: The size of the resident memory (physical memory) occupied

TTY: The terminal on which the process is running. "?" indicates unknown or unnecessary terminal
STAT: Displays the current status of the process, such as S (sleeping), R (running), Z (zombie), < (high priority), N (low priority), s (parent process), + (foreground process). Processes in a zombie state should be terminated manually.

START: The time when the process was started
TIME: The CPU time occupied by the process
COMMAND: The name of the command that started the process

**Summary: ps aux displays process information in the form of a simple list. **

Second type:

ps -elf

-e: Display all process information in the system.

-l: Display process information in long format.

-f: Display process information using full format.

Explanation of the fields in the above figure:
Most of them are the same as the first one, where PPID is the PID of the parent process.

The third type:

top

It displays the process ranking in a full-screen interactive interface, and tracks the usage of system resources including CPU and memory in a timely manner. It refreshes every three seconds by default. Its function is basically similar to the Task Manager in the Windows system.

Explanation of the above picture:

Tasks (system tasks) information: total, the total number of processes; running, the number of running processes; sleeping, the number of dormant processes; stopped, the number of terminated processes; zombie, the number of zombie and unresponsive processes.

CPU information: us, user occupancy; sy, kernel occupancy; ni, priority scheduling occupancy; id, idle CPU; wa, I/O wait occupancy; hi, hardware interrupt occupancy; si, software interrupt occupancy; st, virtualization occupancy. To understand the idle CPU percentage, look at the %id part.

Mem (memory) information: total, total memory space; used, used memory; free, free memory; buffers, cache area.

Swap (swap space) information: total, total swap space; used, used swap space; free, free swap space; cached, cache space.

The fourth type:

pstree -aup

The derivation relationship between processes is displayed in a tree diagram, which has a more intuitive display effect.
-a: Displays the complete instructions for each program, including the path, parameters or the mark of the resident service;
-c: Do not use the simplified notation method;
-G: Use the column drawing characters of the VT100 terminal;
-h: When listing the tree diagram, specially mark the currently executed program;
-H<program identification code>: The effect of this parameter is similar to specifying the "-h" parameter, but specifically indicates the specified program;
-l: Display the tree diagram in long column format;
-n: Sort by program identification code. The default is to sort by program name;
-p: Display program identification code;
-u: Display user name;

This concludes the article about 4 ways to view processes in LINUX (summary). For more information about viewing processes in LINUX, please search for previous articles on 123WORDPRESS.COM or continue to browse the following related articles. I hope you will support 123WORDPRESS.COM in the future!

You may also be interested in:
  • Linux method example to view all information of the process
  • View the port number occupied by the process in Linux
  • How to view process stack information in Linux
  • How to view the number of file handles opened by a process and how to modify them in Linux
  • In-depth understanding of viewing process memory usage under Linux

<<:  Eight examples of how Vue implements component communication

>>:  How to delete a MySQL table

Recommend

MySQL 5.7.21 installation and configuration tutorial under Window10

This article records the installation and configu...

JavaScript closure details

Table of contents 1. What is a closure? 2. The ro...

How to deploy Node.js with Docker

Preface Node will be used as the middle layer in ...

Two ways to declare private variables in JavaScript

Preface JavaScript is not like other languages ​​...

Several scenarios for using the Nginx Rewrite module

Application scenario 1: Domain name-based redirec...

How to export mysql query results to csv

To export MySQL query results to csv , you usuall...

Calendar effect based on jQuery

This article example shares the specific code of ...

Example of implementing a virtual list in WeChat Mini Program

Table of contents Preface analyze Initial Renderi...

Tips for designing photo preview navigation on web pages

<br />Navigation does not just refer to the ...

Webpack file packaging error exception

Before webpack packaging, we must ensure that the...

Delegating Privileges in Linux Using Sudo

Introduction to sudo authority delegation su swit...

Solution to MySQL remote connection failure

I have encountered the problem that MySQL can con...