希望使用kill -9而不是killall使用进程名称。
有没有办法我可以grep或awk给定进程名称的pid / s然后杀死它kill -9?
killall对我来说失败了很多。
我正在寻找为许多远程机器编写脚本。
进程名称将是三个之一。
我想使用类似的东西:
sshpass -p 'password' ssh -n $user@$hostname "one liner to use kill -9"
Run Code Online (Sandbox Code Playgroud)
有任何想法吗?
我正在尝试使用 kill -9 命令终止进程 sublime_text。但是该过程仍然存在,因此我无法打开它的另一个实例。
root@alwin-linux:~# ps aux|grep subl
root 3018 2.2 1.0 289008 61872 ? Ds 12:30 5:27
/opt/sublime_text/sublime_text
root 3037 0.0 0.2 65676 15364 ? Sl 12:30 0:11
/opt/sublime_text/plugin_host 3018
root 6702 0.0 0.0 4432 820 pts/1 S+ 16:35 0:00 grep
--color=auto subl
root@alwin-linux:~# kill -9 3018
root@alwin-linux:~# ps aux|grep subl
root 3018 2.2 1.0 289008
61872 ? Ds 12:30 5:27 /opt/sublime_text/sublime_text
root 3037 0.0 0.2 65676 15364 ? Sl 12:30 0:11
/opt/sublime_text/plugin_host 3018
root 6705 0.0 0.0 …Run Code Online (Sandbox Code Playgroud) 我无法在终端中杀死 viber 进程。
$ pkill Viber
Run Code Online (Sandbox Code Playgroud)
或者
$ pgrep Viber
2849
$ kill 2849
Run Code Online (Sandbox Code Playgroud)
或者
$ killall -v Viber
Killed Viber(2849) with signal 15
Run Code Online (Sandbox Code Playgroud)
不工作。
但是在系统监视器中,从右键单击菜单中选择“杀死进程”将杀死它。
#name - name of killing process
pidof name | kill
为什么它不起作用?