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 to my currently running emacs sessions.
$ ps ax | grep emacs 20284 pts/7 Sl 1:21 emacs Matrix.txt 30261 tty2 Sl+ 2:24 /usr/bin/emacs25 30674 ? Sl 0:00 /usr/bin/emacs25 /usr/include/linux/errno.h 30713 pts/7 S+ 0:00 grep emacs
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 ‘aux’.
a - show processes for all users u - display the process owner x - show processes not attached to a terminal
The status flags can be interpreted as follows:
D - uninterruptible sleep (usually IO)
R - running or runnable (on run queue)
S - interruptible sleep (waiting for an event to complete)
T - stopped by job control signal
t - stopped by debugger during the tracing
W - paging (not valid since the 2.6.xx kernel)
X - dead (should never be seen)
Z - defunct ("zombie") process, terminated but not reaped by its parent
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 ‘x’ argument the session did not appear.