How to kill a process with 'kill' combined with 'grep'

后端 未结 5 1546
-上瘾入骨i
-上瘾入骨i 2021-01-19 01:51

I\'d like to kill a process/script with a simple command using. At the moment I do the following

ps -ef | grep myscriptname
kill 123456

But

5条回答
  •  谎友^
    谎友^ (楼主)
    2021-01-19 02:28

    Another alternative is using the pidof command:

    kill $(pidof processname)
    

提交回复
热议问题