Linux commands: Difference between revisions
Jump to navigation
Jump to search
→Show the process list & kill the process
| Line 268: | Line 268: | ||
#* {{kbd | key=<nowiki>top -a</nowiki>}} or {{kbd | key=<nowiki>ps aux --sort -rss | more</nowiki>}}<ref>[http://linux.vbird.org/linux_basic/0440processcontrol.php#ps_aux 鳥哥的 Linux 私房菜 -- 第十六章、程序管理與 SELinux 初探]</ref> "Sort by memory usage" for {{Linux}} | #* {{kbd | key=<nowiki>top -a</nowiki>}} or {{kbd | key=<nowiki>ps aux --sort -rss | more</nowiki>}}<ref>[http://linux.vbird.org/linux_basic/0440processcontrol.php#ps_aux 鳥哥的 Linux 私房菜 -- 第十六章、程序管理與 SELinux 初探]</ref> "Sort by memory usage" for {{Linux}} | ||
# keyin {{kbd | key=q}} to leave the process list | # keyin {{kbd | key=q}} to leave the process list | ||
Find which process to be killed. And then keyin the process ID (PID): | |||
* {{kbd | key=kill <PID>}} or {{kbd | key=kill -<PID> PID}}. To kill the process with PID number: 101, enter {{kbd | key=kill 101}}. <ref>[http://www.cyberciti.biz/faq/kill-process-in-linux-or-terminate-a-process-in-unix-or-linux-systems/ Kill Process in Linux or Terminate a Process in UNIX / Linux Systems], [https://linux.die.net/man/1/kill kill(1): terminate process - Linux man page]</ref> | |||
* {{kbd | key=kill -9 <PID>}}. Force to kill the process with PID number: 101, enter {{kbd | key=kill -9 101}}. <ref>[http://linux.vbird.org/linux_basic/0440processcontrol.php#killjobs 鳥哥的 Linux 私房菜 -- 第十六章、程序管理與 SELinux 初探]</ref> | |||
Kill the process by process name | |||
* {{kbd | key=<nowiki>sudo kill $(ps aux | grep '名稱' | awk '{print $2}')</nowiki>}} | |||
=== Find process running on port === | === Find process running on port === | ||