从Ubuntu命令行按进程名称杀死进程
There are a number of ways to kill a process if you know the name of the process. Here’s a couple different ways you can accomplish this. We are going to assume that the process we are trying to kill is named irssi
如果您知道進(jìn)程的名稱,則有多種方法可以殺死該進(jìn)程。 您可以通過(guò)以下兩種不同的方法來(lái)完成此操作。 我們將假設(shè)我們要?dú)⑺赖倪M(jìn)程名為irssi
kill $(pgrep irssi)
殺死$(pgrep irssi)
killall -v irssi
Killall -v irssi
pkill irssi
菲爾·伊爾西
kill `ps -ef | grep irssi | grep -v grep | awk ‘{print $2}’`
殺死`ps -ef | grep irssi | grep -v grep | awk'{print $ 2}'`
These techniques can be useful in shell scripts, where you wouldn’t know the process ID and would need to restart or kill a process.
這些技術(shù)在Shell腳本中非常有用,因?yàn)槟恢肋M(jìn)程ID,因此需要重新啟動(dòng)或終止進(jìn)程。
翻譯自: https://www.howtogeek.com/howto/ubuntu/kill-a-process-by-process-name-from-ubuntu-command-line/
總結(jié)
以上是生活随笔為你收集整理的从Ubuntu命令行按进程名称杀死进程的全部?jī)?nèi)容,希望文章能夠幫你解決所遇到的問(wèn)題。
- 上一篇: 进程handle获取线程_获取进程中的线
- 下一篇: 如何在iPhone或iPad的控制中心中