查看所有进程:ps -ef
root 362405 362396 0 Aug28 pts/4 00:00:00 -bash
root 384415 1 2 Aug30 ? 00:22:05 sh clarity11111.sh
root 384421 384415 0 Aug30 ? 00:07:47 python clarity-0.py
root 384427 384415 0 Aug30 ? 00:07:50 python clarity-1.py
root 384433 384415 0 Aug30 ? 00:08:00 python clarity-2.py
root 384439 384415 0 Aug30 ? 00:07:37 python clarity-3.py
root 384445 384415 0 Aug30 ? 00:07:50 python clarity-4.py
root 533581 181150 0 01:24 pts/3 00:00:00 ps -ef
查看clarity进程:
root@shopai2see-c35b61af-3485953850-10k96:~# ps -ef|grep clarity
root 384415 1 2 Aug30 ? 00:22:07 sh clarity11111.sh
root 384421 384415 0 Aug30 ? 00:07:51 python clarity-0.py
root 384427 384415 0 Aug30 ? 00:07:55 python clarity-1.py
root 384433 384415 0 Aug30 ? 00:08:04 python clarity-2.py
root 384439 384415 0 Aug30 ? 00:07:42 python clarity-3.py
root 384445 384415 0 Aug30 ? 00:07:53 python clarity-4.py
root 607871 384415 0 01:26 ? 00:00:00 sh clarity11111.sh
root 607877 181150 0 01:26 pts/3 00:00:00 grep --color=auto clarity
选出所有与clarity有关的进程id
root@shopai2see-c35b61af-3485953850-10k96:~# ps -ef|grep clarity|grep -v grep|awk '{print $2}'
4033
384415
384421
384427
384433
384439
384445
使用xargs kill所有进程然后查看进程
root@shopai2see-c35b61af-3485953850-10k96:~# ps -ef|grep clarity|grep -v grep|awk '{print $2}'|xargs kill -9
root@shopai2see-c35b61af-3485953850-10k96:~# ps -ef|grep clarity
root 39366 181150 0 01:27 pts/3 00:00:00 grep --color=auto clarity