How does linux view the process?

How to view the process in linux: 1. Use the "ps aux" command to view, which can display process information in a simple list; 2. Use the "ps -elf" command to view; 3. Use the "top" command to view; 4. Use the "pstree -aup" command to view.



Operating environment of this tutorial: linux5.9.8 system, this article is applicable to all brands of computers.

How to view processes in linux A

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

**View process method: **The

first:

1

ps aux

ps command is used to report the current process status of the system. It can be used with the kill command to interrupt and delete unnecessary programs at any time. The ps command is the most basic and also very powerful process view command. With this command, you can determine which processes are running and running, whether the process is over, whether the process is dead, which processes are occupying too many resources, etc. 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 a user-oriented format.

x: Display the current user's processes in all terminals.

Example:



**Explanation of each field 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 the CPU occupied
%MEM: the memory occupied Percentage

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

TTY: On which terminal the process is running. "?" means unknown or unnecessary terminal
STAT: shows the current status of the process, such as S (sleep), R (running), Z (zombie), <(high priority), N (low priority), s ( Parent process), + (foreground process). Processes in a deadlock state should be manually terminated.

START: The time to start the process
TIME: The process occupies CPU time
COMMAND: The name of the command to start the process

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

The second type:

1

ps -elf

-e: Display all process information in the system.

-l: Use long format to display process information.

-f: Display process information in full format.



Explanation of the fields in the above figure:

Most of them are the same as the first one, PPID is the PID of the parent process.

The third type:

1

top

displays the ranking of processes in a full-screen interactive interface, and timely tracks the occupation of system resources including CPU and memory. By default, it refreshes every three seconds. Its function is basically similar to the task manager in the Windows system.



The above figure explains:

Tasks (system task) information: total, the total number of processes; running, the number of running processes; sleeping, the number of sleeping processes; stopped, the number of aborted processes; zombie, the number of dead and unresponsive processes.

CPU information: us, user occupation; sy, kernel occupation; ni, priority scheduling occupation; id, idle CPU; wa, I/O waiting occupation; hi, hardware interrupt occupation; si, software interrupt occupation; st, virtualization occupation . To understand the percentage of idle CPU, mainly see 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:

1

pstree -aup

can bring |grep to query specific processes. For example, pstree -aup | grep php



displays the derivation relationship between processes in a tree diagram, and the display effect is relatively intuitive.
-a: Display the complete instructions of each program, including the path, parameters or resident service signs;
-c: do not use the condensed notation;
-G: use the column drawing characters of the VT100 terminal;
-h: list the tree When displaying a graph, specifically indicate the program currently being executed;
-H<program identification code>: The effect of this parameter is similar to that of specifying the "-h" parameter, but the specified program is specifically marked;
-l: The tree diagram is displayed in a 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;

Guess you like

Origin blog.csdn.net/zl17822307869/article/details/112571925