Linux process management ps and top (important)

basic introduction

1) 在LINUX中,每个执行的程序(代码)都称为一个进程。每一个进程都分配一个ID号。
2) 每一个进程,都会对应一个父进程,而这个父进程可以复制多个子进程。例如www服务器
3) 每个进程都可能以两种方式存在的。前台 与后台,所谓前台进程就是用户目前的屏幕上可以进行操作的。
后台进程则是实际在操作,但由于屏幕上无法看到的进程,通常使用后台方式执行[sshd , crond]4) 一般系统的服务都是以后台进程的方式存在,而且都会常驻在系统中。直到关机才才结束。

Display the processes executed by the system

The ps command is used to view what is being executed in the current system, and the status of their execution. Can not add any parameters

Information options displayed by ps

Field Description
PID Process identification number
TTY Terminal number
TIME CPU time consumed by the process
CMD The name of the command or process being executed
 ps -a :显示当前终端的所有进行信息
 ps -u :以用户的格式显示进程信息
 ps -x :显示后台进程运行的参数
 

ps -aux information
Insert picture description here

ps -aux 
System V展示风格
USER:用户名称
PID:进程号
%CPU:进程占用CPU的百分比
%MEM:进程占用物理内存的百分比
VSZ:进程占用的虚拟内存大小(单位:KB)
RSS:进程占用的物理内存大小(单位:KB)
TTY:终端名称,缩写 .
STAT:进程状态,其中S-睡眠,s-表示该进程是会话的先导进程,N-表示进程拥有比普通优先级更低的优
先级,R-正在运行,D-短期等待,Z-僵死进程,T-被跟踪或者被停止等等
STARTED:进程的启动时间
TIME:CPU时间,即进程使用CPU的总时间
COMMAND:启动进程所用的命令和参数,如果过长会被截断显示

The
introduction of kill and killall processes :
If a process needs to be stopped during half of its execution, or when a lot of system resources have been consumed, you can consider stopping the process at this time. Use the kill command to complete this task.
Basic syntax:

kill [选项] 进程号(功能描述:通过进程号杀死进程 -9 强制终止)
killall 进程名称 (功能描述:通过进程名称杀死进程,也支持通配符,这在系统因负载过大而变得很慢时很有用)
常用选项:
-9 :表示强迫进程立即停止

Process monitoring # The
syntax
top is very similar to the ps command. They are used to show the process being executed. The biggest difference between Top and ps is that top
can update the running process during its execution for a period of time (changes every 3 seconds by default)

parameter Features
-d seconds Specify the top command to update every few seconds, the default is 3 seconds
-i Make top not display any idle or dead processes
-p Only monitor the status of a certain process by specifying a healthy process id

Insert picture description here
Insert picture description here

Guess you like

Origin blog.csdn.net/qq_43674360/article/details/111310894