{"id":194,"date":"2010-04-03T19:31:44","date_gmt":"2010-04-04T01:31:44","guid":{"rendered":"http:\/\/www.pervasivecode.com\/blog\/?p=194"},"modified":"2010-04-03T19:32:06","modified_gmt":"2010-04-04T01:32:06","slug":"unix-tip-kill-stop-and-kill-cont","status":"publish","type":"post","link":"http:\/\/www.pervasivecode.com\/blog\/2010\/04\/03\/unix-tip-kill-stop-and-kill-cont\/","title":{"rendered":"Unix tip: kill -STOP and kill -CONT"},"content":{"rendered":"<p>Pretty much every Unix user knows about the kill command, and most know about &#8216;kill -KILL&#8217; aka &#8216;kill -9&#8217;.<\/p>\n<p>But do you know about kill -STOP and kill -CONT?<br \/>\n<!--more--><br \/>\nI&#8217;m not sure of the exact mechanism (kernel vs. user process) but everything I&#8217;ve used it on on a Mac OS X machine has responded to it in the same way. So you may find a process that doesn&#8217;t do this, but I haven&#8217;t found one.<\/p>\n<p>Basically <code>kill -STOP 1234<\/code> will pause the process with pid 1234, and <code>kill -CONT 1234<\/code> will resume it. It&#8217;s as if you can sleep individual applications instead of your entire computer.<\/p>\n<p>It&#8217;s simple, but you can probably imagine why this would be useful. Want to keep Firefox with 45 tabs open, but you&#8217;re not using it for a while and you want to save battery life? Pause it. Pretty much anything like &#8220;I don&#8217;t want to quit and then re-launch this but I wish it wasn&#8217;t using a bunch of CPU time while it idles&#8221; is a good candidate.<\/p>\n<p>Remember that this means your app my time out when it is resumed, as if you had slept your laptop. So network connections it had open when you paused it may be broken when you resume it. So pausing Terminal.app with a bunch of open ssh connections to remote servers isn&#8217;t going to work too well.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Pretty much every Unix user knows about the kill command, and most know about &#8216;kill -KILL&#8217; aka &#8216;kill -9&#8217;. But do you know about kill -STOP and kill -CONT?<\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[2,11,3,1],"tags":[],"class_list":["post-194","post","type-post","status-publish","format-standard","hentry","category-linux","category-mac","category-ubuntu","category-uncategorized"],"_links":{"self":[{"href":"http:\/\/www.pervasivecode.com\/blog\/wp-json\/wp\/v2\/posts\/194"}],"collection":[{"href":"http:\/\/www.pervasivecode.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/www.pervasivecode.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/www.pervasivecode.com\/blog\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"http:\/\/www.pervasivecode.com\/blog\/wp-json\/wp\/v2\/comments?post=194"}],"version-history":[{"count":2,"href":"http:\/\/www.pervasivecode.com\/blog\/wp-json\/wp\/v2\/posts\/194\/revisions"}],"predecessor-version":[{"id":196,"href":"http:\/\/www.pervasivecode.com\/blog\/wp-json\/wp\/v2\/posts\/194\/revisions\/196"}],"wp:attachment":[{"href":"http:\/\/www.pervasivecode.com\/blog\/wp-json\/wp\/v2\/media?parent=194"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/www.pervasivecode.com\/blog\/wp-json\/wp\/v2\/categories?post=194"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/www.pervasivecode.com\/blog\/wp-json\/wp\/v2\/tags?post=194"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}