{"id":408,"date":"2021-01-05T12:01:00","date_gmt":"2021-01-05T12:01:00","guid":{"rendered":"http:\/\/qedevelopment.co.uk\/?p=408"},"modified":"2021-01-05T12:01:01","modified_gmt":"2021-01-05T12:01:01","slug":"linux-how-to-find-pid-for-a-locked-session","status":"publish","type":"post","link":"https:\/\/qedevelopment.co.uk\/?p=408","title":{"rendered":"Linux: How to Find PID for a locked session"},"content":{"rendered":"\n<p>Recently I have been getting emacs sessions locking up on my ubuntu machine. With several emacs sessions open, and no way out other than killing the specific session, you need to find the correct PID. But which session is which?<\/p>\n\n\n\n<p>You can get additional info regarding processes using ps. The example below gives information relating to my currently running emacs sessions.<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">$ ps ax | grep emacs\n20284 pts\/7 Sl  1:21 emacs Matrix.txt\n30261 tty2  Sl+ 2:24 \/usr\/bin\/emacs25\n30674 ?     Sl  0:00 \/usr\/bin\/emacs25 \/usr\/include\/linux\/errno.h\n30713 pts\/7 S+  0:00 grep emacs<\/pre>\n\n\n\n<p>The numbers at the head of the last four lines correspond to the PID for each emacs session. If you need to know the process owner call ps with the argument &#8216;aux&#8217;.<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">a - show processes for all users\nu - display the process owner\nx - show processes not attached to a terminal<\/pre>\n\n\n\n<p>The status flags can be interpreted as follows:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>D - uninterruptible sleep (usually IO)\nR - running or runnable (on run queue)\nS - interruptible sleep (waiting for an event to complete)\nT - stopped by job control signal\nt - stopped by debugger during the tracing\nW - paging (not valid since the 2.6.xx kernel)\nX - dead (should never be seen)\nZ - defunct (\"zombie\") process, terminated but not reaped by its parent<\/code><\/pre>\n\n\n\n<p>In my case the stalled session was newly opened, so the time was an indication, as was the command line used to start the session. Also, the session was not started from the command line, so without the &#8216;x&#8217; argument the session did not appear.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Recently I have been getting emacs sessions locking up on my ubuntu machine. With several emacs sessions open, and no way out other than killing the specific session, you need to find the correct PID. But which session is which? You can get additional info regarding processes using ps. The example below gives information relating &hellip; <\/p>\n<p class=\"link-more\"><a href=\"https:\/\/qedevelopment.co.uk\/?p=408\" class=\"more-link\">Continue reading<span class=\"screen-reader-text\"> &#8220;Linux: How to Find PID for a locked session&#8221;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"om_disable_all_campaigns":false,"_mi_skip_tracking":false,"_monsterinsights_sitenote_active":false,"_monsterinsights_sitenote_note":"","_monsterinsights_sitenote_category":0},"categories":[30,11],"tags":[33,22],"aioseo_notices":[],"_links":{"self":[{"href":"https:\/\/qedevelopment.co.uk\/index.php?rest_route=\/wp\/v2\/posts\/408"}],"collection":[{"href":"https:\/\/qedevelopment.co.uk\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/qedevelopment.co.uk\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/qedevelopment.co.uk\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/qedevelopment.co.uk\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=408"}],"version-history":[{"count":3,"href":"https:\/\/qedevelopment.co.uk\/index.php?rest_route=\/wp\/v2\/posts\/408\/revisions"}],"predecessor-version":[{"id":411,"href":"https:\/\/qedevelopment.co.uk\/index.php?rest_route=\/wp\/v2\/posts\/408\/revisions\/411"}],"wp:attachment":[{"href":"https:\/\/qedevelopment.co.uk\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=408"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/qedevelopment.co.uk\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=408"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/qedevelopment.co.uk\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=408"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}