当前位置:网站首页>Process management (dynamic)
Process management (dynamic)
2022-08-10 07:41:00 【anqiujiaduizhang】
目录
3.3Check the version and kernel of the system
进程是已启动的可执行程序的运行实例,是程序运行的过程,动态的 ,有生命周期及运行状态.
程序:二进制文件 ,静态
一、查看进程
1.1静态查看进程
ps aux | less
ps : process snapashot
a :You can only view all terminal processes running in the system
u :显示进程拥有者
x :显示系统内所有进程
f :显示进程之间的父子关系
USER:运行进程的用户
PID :进程ID
%CPU:CPU占用率
%MEM:内存占用率
VSZ :进程占用的虚拟内存大小
RSS :占用的物理内存大小
TTY :?表示没有占用终端
STAT:进程状态 (R 运行 S 可中断睡眠 D 不可中断睡眠 T 停止的进程 Z 僵尸进程 X 死掉的进程)
START:进程的启动时间
TIME :进程占用CPU的总时间
COMMAND:进程文件,进程名
进程状态 (了解)
Sl 以线程的方式运行
Ss s进程的领导者,父进程
R+ +Represents the process group in the foreground
S< <优先级较高的进程
SN N优先级较低的进程查看tty的方法:
tty
?Indicates that the process did not occupy the terminal when it was started
ps -ef
参数解释:
-e 显示所有进程
-l 长格式显示
-f 完整格式
UID 用户ID
PID 进程ID
PPID 父进程ID
C CPU占用率
STIME 开始时间
TTY 开始此进程的TTY 即终端设备
TIME 此进程运行的总时间
CMD 命令名
1.2动态查看进程
top 动态显示信息,三秒刷新一次
在工作中必须监控的东西 load average (平均负载)等待cpu处理的队列长度 也是个数
1分钟 第一个数字
5分钟 第二个数字
15分钟 第三个数字计算cpu 负载:load average 的三个值:0.10,0.16,0.12 分别除cpu的个数,得出的值,如果值大于1 Then the load at this time is high
top
h|? 帮助
> 往下翻页
< 往上翻页
M 按内存排序
P 按CPU排序
q 退出
z 彩色显示
w 保存
PR 优先级
VIRT 进程使用的虚拟内存总量,单位kb VIRT=SWAP+RES
RES 进程使用的、未被换出的物理内存大小,单位kb
SHR 共享内存大小,单位kb
ni nice值
id cpu空闲率
wa cpu等待,等待输入/输出的进程占用的CPU百分比.如果使用率过高,表示硬盘该换了
进程优先级nice
nice值越高:表示优先级越低,例如+19 ,该进程容易将CPU使用量让给其他进程
nice值越低:表示优先级越高,例如-20 ,该进程更不倾向于让出CPU
1.3查看单个PID
yum -y install httpd
systemctl start httpd
cat /var/run/httpd/httpd.pid
1043
1.4查看指定PID
ps aux | grep sshd
1.5查看端口
yum -y install lsof
lsof -i:80 #View processes with ports
Check the network process and the port it is listening on netstat -lntp 参数详解: -a Show all processes -u 显示 udp -n 以数字的形式显示协议名称 -t tcp -p Displays the process name and pid -l 只显示正在被监听的端口 *w See the process information that has been waiting for the landing to the terminal,Remote login will be availableip地址
二、进程控制
2.1按pid杀死进程
kill 信号 PID
pkill 信号 进程名 信号也是进程间通信的一种方式
kill -l 查看所有信号
-1 HUP 重新加载进程或者重新加载配置文件,PID不变
-9 KILL 强制杀死
-15 TERM 正常杀死(可不写)
-18 CONT 激活进程
-19 STOP 挂起进程
2.2作业控制
什么是作业?
Job control refers to controlling the behavior of a running process.比如,The user can suspend a process or put it to run in the background,Wait for a while before continuing the process.
[[email protected] ~]# sleep 500 &(& Let a command or program run in the background)
[1] 82223 (are the job number of the program, respectively and the processPID)
[[email protected] ~]# sleep 600 &
[2] 82505
[[email protected] ~]# sleep 700 &
[3] 82625
[[email protected] ~]# jobs Check the job number in the background
[1] 运行中 sleep 500 &
[2]- 运行中 sleep 600 &
[3]+ 运行中 sleep 700 &
[[email protected] ~]# fg %1 #Bring the background program to the foreground
sleep 500
^Z -------> Ctrl z 暂停
[1]+ 已停止 sleep 500
[[email protected] ~]# bg %1 #Let suspended programs run in the background,%用来修饰job number , 1就是job number The job number of the program
[1]+ sleep 500 &
[[email protected] ~]# jobs
[1] 运行中 sleep 500 &
[2]- 运行中 sleep 600 &
[3]+ 运行中 sleep 700 &
[[email protected] ~]# kill -9 %1
[[email protected] ~]# ps aux | grep sleep
root 101412 0.0 0.0 112824 988 pts/2 R+ 10:21 0:00 grep --color=auto sleep
三、常用命令
3.1查看当前CPU负载
[[email protected] ~]# uptime
10:29:27 up 1 day, 21:59, 3 users, load average: 0.19, 0.18, 0.19
3.2查看内存使用
[[email protected] ~]# free -m (-g 计量单位)
total used free shared buff/cache available
Mem: 976 119 153 12 703 665
Swap: 2047 0 2047
3.3Check the version and kernel of the system
[[email protected] ~]# cat /etc/redhat-release #查看版本
CentOS Linux release 7.4.1708 (Core)
[[email protected] ~]# uname
Linux
[[email protected] ~]# uname -a #查看正在运行的内核版本
Linux localhost.localdomain 3.10.0-693.el7.x86_64 #1 SMP Tue Aug 22 21:09:27 UTC 2017 x86_64 x86_64 x86_64 GNU/Linux
[[email protected] ~]# uname -r #查看内核版本
3.10.0-693.el7.x86_64
3.4修改主机名
hostnamectl set-hostname xxxx #主机名,Disconnect from the terminal after modification,然后重新连接即可
vim /etc/hostname xxxx #改名后重启
边栏推荐
猜你喜欢
预测股票涨跌看什么指标,如何预测明天股票走势
IDLE development wordCount program (5)
【Rust指南】使用Cargo工具高效创建Rust项目 | 理解Rust特别的输入输出语句
张驰课堂:老板会武术,谁也挡不住!六西格玛培训的魅力
探索神经网络架构教程视频,设计神经网络的步骤
CuteOneP is a PHP-based OneDrive multi-network disk mount program with member synchronization and other functions
MySQL设置初始密码—注意版本mysql-8.0.30
Data types for database learning
Add spark related dependencies and packaging plugins (sixth bullet)
BUUCTF Notes (web)
随机推荐
探索神经网络架构教程视频,设计神经网络的步骤
CV-人脸识别-2018:ArcFace
.NET-8. My Thought Notes
简单业务类
神经网络样本太少怎么办,神经网络训练样本太少
SCS【2】单细胞转录组 之 cellranger
The constraints of the database learning table
初使jest 单元测试
时序动作定位 | ACGNet:弱监督时序动作定位的动作补充图网络(AAAI 2022)
winget包管理器
如何远程调试对方的H5页面
VS2013-debug assembly code-generate asm file-structure memory layout-function parameter stack-calling convention
【MySQL】SQL语句
Basic use of Log4j2
图像处理用什么神经网络,神经网络提取图片特征
【Day10】进程管理命令
颜色选择器的使用
自动化测试框架Pytest(二)——前后置处理
AFNetworking概述和4.0的实践
Nude speech - lying flat - brushing questions - big factory (several tips for Android interviews)