Linux Process Operation Information
Linux Process operations
There are five processes in Linux:
1. Run (running or waiting in the running Queue)
2. interruption (in sleep, blocked, waiting for the formation or receipt of a signal of a condition)
3. Do not interrupt (do not wake up when receiving the signal or do not run, the process must wait until there is an interruption)
4. Stiff (the process has been terminated, but the process descriptor exists until the parent process calls wait4 () and is released after the system call)
5. Stop (the process stops running after receiving signals from SIGSTOP, SIGSTP, SIGTIN, and SIGTOU)
The ps command is used to statically view what is being executed in the current system and how they are executed. You can add no parameters.
Ps-a: displays information about all processes on the current terminal.
Ps-u: displays process information in user format
Ps-x: displays the parameters of background processes.
I like to directly connect the three parameters: ps-aux to find more comprehensive and detailed information.
Example:
Parameter description:
USER: The process belongs to the USER account
PID: Number of the process
% CPU: Percentage of CPU resources used by the process
% MEM: Percentage of physical memory occupied by the process
VSZ: virtual memory used by the process (Kbytes)
RSS: the fixed amount of memory occupied by the process (Kbytes)
TTY: The process operates on that terminal. If it is irrelevant to the terminal, it will display ?, In addition, the tty1-tty6 is the login program on the machine, if the pts/0 and so on, it indicates the program connected to the host by the network.
STAT: the current state of the program. The main states are:
R: The program is currently running or can be operated.
S: The program is currently in sleep (or idle State), but can be awakened by some signals (signal.
T: The program is currently detecting or stopping
Z: The program should have been terminated, but its parent program cannot terminate it normally, resulting in the state of zombie (zombie) program.
START: the time when the process is triggered.
TIME: the actual CPU usage TIME of the process.
COMMAND: the actual COMMAND of the program.
Top dynamically view process usage
23:59:58 current time
Up system running time, format: minute
2 user: current number of logon users
Load average: 0.00, 0.00, 0.00 system load, that is, the average length of the task queue. The three values are the average values from 1 minute, 5 minutes, and 15 minutes ago to the present.
Total process count
Number of running Processes of running
Number of sleeping Processes
Number of stopped Processes
Zombie botnets
Cpu (s ):
Xx % us CPU usage
Xx % sy CPU usage in kernel space
Xx % ni CPU usage percentage of processes with changed priorities in the process space
Xx % id idle CPU percentage
Xx % wa CPU time percentage waiting for Input/Output
Xx % hi: Percentage of hardware CPU interruptions
Xx % si: Percentage of Soft Interrupt occupied
Xx % st: Virtual Machine usage percentage
Mem:
1004412 k total physical memory
Total physical memory used by 221404 k used
783008 k free Memory Total
Memory usage of 17268 k buffers as kernel Cache
Swap:
2031668 k total swap zone total
Total number of swap areas used by 0 k used
2031608 k free swap zone total
The total number of swap zones in the 97902 k cached buffer. The content in the memory is swapped out to the swap zone and then into the memory, but the used swap zone is not covered yet, this value indicates the size of the SWAp zone where the content already exists. When the corresponding memory is swapped out again, you do not have to write data to the swap zone.
Serial Number Column name meaning
A PID process id
B PPID parent process id
C RUSER Real user name
D UID: User ID of the process owner
E USER: USER Name of the process owner
GROUP name of the owner of the f GROUP process
The terminal name of the g TTY startup process. Processes not started from the terminal are displayed?
H PR priority
I NI nice value. A negative value indicates a high priority, and a positive value indicates a low priority.
The final CPU used by j P is only meaningful in multiple CPU Environments
K % percentage of CPU time used since the last CPU update to the present
L total cpu time used by the TIME process, in seconds
M TIME + the total cpu time used by the process, in the unit of 1/100 seconds
N % MEM percentage of physical memory used by the Process
O total virtual memory used by the VIRT process, in kb. VIRT = SWAP + RES
The SWAP size in the virtual memory used by the p SWAP process, in kb.
The size of the physical memory used by the q RES process, Not swapped out, in kb. RES = CODE + DATA
The physical memory occupied by the r CODE executable CODE, in kb.
Physical memory occupied by other parts (DATA Segment + stack) except the executable code of s DATA, in kb
T SHR shared memory size, in kb
U nFLT page error count
The number of modified pages that the last write to the present by v.
W S Process status (D = non-disruptive sleep status, R = running, S = sleep, T = tracking/stopping, Z = zombie process)
X COMMAND name/COMMAND line
Y WCHAN: if the process is sleep, the system function name in sleep is displayed.
Z Flags task flag, refer to sched. h
Process Termination
Kill process number: terminate a process
Kill-9 process no.: Force terminate a process
Kill-u User name: terminate a user's Process
Here we will briefly introduce three common termination process commands.
In Linux, only three steps are required to view the running path of a process:
1. First, check the process Number of the process to be queried, ps or top.
Ii. When Linux starts a process, the system will create a folder named PID under/proc, where information about our processes will be displayed.
Cd/proc/PID: Enter the process directory.
3. Run ls-l.
Note:
The cwd symbol links the process running directory.
The exe symbolic connection is the absolute path of the execution program.
Cmdline is the command line command entered when the program is running.
Environ records the environment variables when the process is running.
This article permanently updates the link address: