{"id":643,"date":"2013-05-19T08:26:22","date_gmt":"2013-05-19T08:26:22","guid":{"rendered":"http:\/\/scunster.co.uk\/?p=643"},"modified":"2013-11-20T12:02:17","modified_gmt":"2013-11-20T12:02:17","slug":"kill-a-process-by-process-name-from-ubuntu-command-line","status":"publish","type":"post","link":"https:\/\/scunster.co.uk\/?p=643","title":{"rendered":"Kill a Process by Process Name from Ubuntu Command Line"},"content":{"rendered":"<p>There are a number of ways to kill a process if you know the name of the process. Here\u2019s a couple different ways you can accomplish this. We are going to assume that the process we are trying to kill is named <em>Unreal<\/em><\/p>\n<p><code>kill $(pgrep Unreal)<\/code><br \/>\n<code>killall -v Unreal<\/code><br \/>\n<code>pkill Unreal<\/code><br \/>\n<code>kill `ps -ef | grep Unreal | grep -v grep | awk \u2018{print $2}\u2019`<\/code><br \/>\nThese techniques can be useful in shell scripts, where you wouldn\u2019t know the process ID and would need to restart or kill a process.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>There are a number of ways to kill a process if you know the name of the process. Here\u2019s a couple different ways you can accomplish this. We are going to assume that the process we are trying to kill is named Unreal kill $(pgrep Unreal) killall -v Unreal pkill Unreal kill `ps -ef | [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[164,3,131],"tags":[],"class_list":["post-643","post","type-post","status-publish","format-standard","hentry","category-centos","category-linux","category-ubuntu-linux"],"_links":{"self":[{"href":"https:\/\/scunster.co.uk\/index.php?rest_route=\/wp\/v2\/posts\/643","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/scunster.co.uk\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/scunster.co.uk\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/scunster.co.uk\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/scunster.co.uk\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=643"}],"version-history":[{"count":3,"href":"https:\/\/scunster.co.uk\/index.php?rest_route=\/wp\/v2\/posts\/643\/revisions"}],"predecessor-version":[{"id":888,"href":"https:\/\/scunster.co.uk\/index.php?rest_route=\/wp\/v2\/posts\/643\/revisions\/888"}],"wp:attachment":[{"href":"https:\/\/scunster.co.uk\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=643"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/scunster.co.uk\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=643"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/scunster.co.uk\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=643"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}