根据进程名杀死进程 -kill -9 $(pidof 进程名关键字)

参考:https://blog.csdn.net/zhaoyue007101/article/details/7699259

#kill -9 $(ps -ef|grep 进程名关键字|gawk '$0 !~/grep/ {print $2}' |tr -s '\n' ' ')

在开发平台上ps -ef不支持,执行项只有

# ps -ef
ps: invalid option -- 'e'
BusyBox v1.23.2 (2016-11-15 23:14:33 CST) multi-call binary.

Usage: ps 

Show list of processes

        w       Wide output
        l       Long output
        T       Show threads


修改字段:

ps -l | grep jarves | awk '$0 !~/grep/ {print $2}' |tr -s '\n' ' '

ps -l | grep jarves  
S     0  7414   520  3576   400 ttyS0 01:31 00:00:00 grep jarves

# ps -w | grep jarves
  779 root      250m S    {MSystem::Run} /applications/bin/jarves
 9367 root      3576 S    grep jarves
 
# ps -w | grep jarves | awk '$0 !~/grep/ {print $1}'
779

然后可以用:

kill -9 $(ps -w | grep jarves | awk '$0 !~/grep/ {print $1}')

这个是利用管道和替换将 进程名对应的进程号提出来作为kill的参数。很显然上面的方法能完成但是过于复杂,

下面这种就显得简单的多了
2、#kill -9 $(pidof 进程名关键字)

kill -9 $(pidof jarves)

 

附录:

linux signals

Signal NameNumberDescription
SIGHUP1Hangup (POSIX)
SIGINT2Terminal interrupt (ANSI)
SIGQUIT3Terminal quit (POSIX)
SIGILL4Illegal instruction (ANSI)
SIGTRAP5Trace trap (POSIX)
SIGIOT6IOT Trap (4.2 BSD)
SIGBUS7BUS error (4.2 BSD)
SIGFPE8Floating point exception (ANSI)
SIGKILL9Kill(can't be caught or ignored) (POSIX)
SIGUSR110User defined signal 1 (POSIX)
SIGSEGV11Invalid memory segment access (ANSI)
SIGUSR212User defined signal 2 (POSIX)
SIGPIPE13Write on a pipe with no reader, Broken pipe (POSIX)
SIGALRM14Alarm clock (POSIX)
SIGTERM15Termination (ANSI)
SIGSTKFLT16Stack fault
SIGCHLD17Child process has stopped or exited, changed (POSIX)
SIGCONT18Continue executing, if stopped (POSIX)
SIGSTOP19Stop executing(can't be caught or ignored) (POSIX)
SIGTSTP20Terminal stop signal (POSIX)
SIGTTIN21Background process trying to read, from TTY (POSIX)
SIGTTOU22Background process trying to write, to TTY (POSIX)
SIGURG23Urgent condition on socket (4.2 BSD)
SIGXCPU24CPU limit exceeded (4.2 BSD)
SIGXFSZ25File size limit exceeded (4.2 BSD)
SIGVTALRM26Virtual alarm clock (4.2 BSD)
SIGPROF27Profiling alarm clock (4.2 BSD)
SIGWINCH28Window size change (4.3 BSD, Sun)
SIGIO29I/O now possible (4.2 BSD)
SIGPWR30Power failure restart (System V)
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值