Linux查看进程

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
#! sh

ps aux
#a:所有终端上的进程,包括其他用户
#u:详细
#x:显示没有终端的进程

# USER PID %CPU %MEM VSZ RSS TT STAT STARTED TIME COMMAND
# tianweiye 8858 1.2 0.1 4334636 4500 s002 S 4:28AM 0:00.76 -zsh
# root 9208 0.0 0.0 4268732 924 s002 R+ 4:30AM 0:00.00 ps au
# root 8857 0.0 0.1 4333576 4576 s002 Ss 4:28AM 0:00.04 login -
# tianweiye 8784 0.0 0.0 4308500 2936 s000 S+ 4:27AM 0:00.05 ssh ubu
# tianweiye 7014 0.0 0.0 4334636 3528 s000 S 4:10AM 0:00.58 -zsh
# root 7012 0.0 0.0 4333576 3420 s000 Ss 4:10AM 0:00.07 login -


top
#按cup 内存占用率动态显示进程
#q 退出

# PID COMMAND %CPU TIME #TH #WQ #PORT MEM PURG CMPRS PGRP PPID STATE BOOSTS %CPU_ME %CPU_OTHRS UID FAULTS COW
# 53036 Terminal 28.4 15:04.51 15 8 510- 170M- 21M- 23M- 53036 1 sleeping *0[70099] 0.05011 2.31246 501 18804000+ 3627
# 262 WindowServer 25.1 09:45:18 11 5 6096- 1245M- 15M 295M 262 1 sleeping *0[1] 5.28172 0.02436 88 602179346+ 1160398
# 257 com.apple.We 13.0 05:20.54 27 5 273 497M+ 24M 110M 257 1 sleeping *0[158296+] 0.00000 0.00846 501 744778+ 2382
# 176 hidd 5.8 02:03:27 8 3 341 5288K 0B 2184K 176 1 sleeping *0[1] 0.07125 0.00000 261 4498867+ 175
# 0 kernel_task 5.6 05:16:22 217/8 0 0 383M 0B 0B 0 0 running 0[0] 0.00000 0.00000 0 242974 0
# 9693 top 5.5 00:01.08 1/1 0 25 8460K+ 0B 0B 9693 8858 running *0[1] 0.00000 0.00000 0 6268+ 111



echo "结束:kill PID"
echo "终结:kill -9 PID"
#如果无法杀死, -9强行终止 杀死进程
#不要随意杀死root身份的进程

转载请注明来源 https://tianweiye.github.io