kill指定应用进程
获取进程的PID:
ps | grep test | awk 'NR==1{print $1}'
通过管道把PID传给kill -9无法生效,需要使用:
ps -ef|grep webapp|awk 'NR==1{print $2}'|xargs kill -9
如当前嵌入式设备上无法使用xargs可使用如下的方式(注意反单引号):
kill -9 `ps -ef|grep webapp|awk 'NR==1{print $2}'`
或者:
kill -9 $(ps -ef|grep webapp|awk 'NR==1{print $2}')