请问如何用一条命令查找test用户的PHP进程,并将这些进程终止?

WBOY
Release: 2016-06-06 20:52:30
Original
1241 people have browsed it

能不能给小白详细描述下呢 ?谢谢~

回复内容:

能不能给小白详细描述下呢 ?谢谢~

ps aux | grep php | awk -F ' ' '{print $1" "$2" "$11}' | awk -F ' ' '$1="test"{print $2}' | xargs kill -9

1: ps aux 列出所有进程
2: grep php 过滤php进程
3: awk -F ' ' '{print $1" "$2" "$11}' 筛选出第1、2、11列,分别是 用户名、PID、进程名称
4: awk -F ' ' '$1="test"{print $2}' 过滤第一列 = test,并打印出第2列的PID
5: xargs kill -9 用xargs 调用 kill -9 杀死

kill -9 $(ps -ef | grep test | grep php| grep -v grep | awk '{print $2}')

什么操作系统?lz问问题也太不专业了

试卷的一道题。。。。show processlist,得到记录,其中有个数据列id,然后
kill id行不行?

Related labels:
php
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template