VU Math: Intro to Our Computer Systems

KILLING IDLE LOGIN SESSIONS

Sometimes -- due to a program crash or a phone line interruption -- you may get disconnected from the departmental computer without properly terminating all ofyour jobs. Thus, you may still have jobs running that you are no longer working with. These are a distraction, and they consume system resources, so it is best to terminate them.

To check if you have multiple logins, type

finger
This will tell you everyone who is logged on, and how long their sessions have been idle, for example:
Login       Name              TTY Idle    When            Office
mckenzie Ralph McKenzie        02 1:35 Mon 09:29  SC1505      322 7456
sstanley Sonya Stanley         03    6 Mon 10:48 
prassie  Efstratios Prassidis  05   14 Mon 10:54  SC 1510     322 6666
kearnes  Keith A. Kearnes      06      Mon 10:55  SC 1523     322 6658
mne      Mark Ellingham        07   48 Mon 08:26  SC 1514     322 6670
mne      Mark Ellingham        08   45 Mon 08:30  SC 1514     322 6670
mne      Mark Ellingham        09      Mon 09:15  SC 1514     322 6670
tschantz Steven Tschantz       10   36 Mon 08:13  SC 1507     322 6664
assda    David Assaf IV        p0 2:17 Mon 08:16  SC 1401J    322 6653
If you are listed several times here, look at the "Idle" column to figure out which ones are the disconnected logins, and which is your current one (should show no idle time; the others should show idle time in hours and minutes or, in extreme cases, in days). Note the terminal number for your current login, which is in the "TTY" column. Here, the current session for "mne" is probably on terminal 09, and the disconnected ones are on terminals 07 and 08.

Next you need to find the process numbers for all processes you are running. To do this, type

ps ux
and you'll get something like this:
USER       PID %CPU %MEM   SZ  RSS TT STAT   TIME COMMAND
mne       8956  4.3  5.6  608  476 09 R      0:00 ps ux
mne       7710  0.0  2.0  404  156 07 S      0:01 -csh (csh)
mne       7714  0.0  2.0  404  156 08 S      0:05 -csh (csh)
mne       7735  0.0  2.3  404  188 09 S      0:03 -csh (csh)
The process numbers are in the "PID" column, and you can tell what terminal each process was run from using the "TT" column. We want to kill everything except our current session, which is on terminal 09: so we choose those rows that DO NOT have 09 in the "TT" column. In this instance, that means processes 7710 and 7714.

To kill the bad processes, type

kill -9 7710 7714
(where in general the "7710 7714" should be replaced by the numbers of the processes to be killed, separated by spaces - you always need the "-9").

Now verify that your disconnected logins have vanished by typing "finger" again:

Login       Name              TTY Idle    When            Office
mckenzie Ralph McKenzie        02 1:37 Mon 09:29  SC1505      322 7456
sstanley Sonya Stanley         03      Mon 10:48 
prassie  Efstratios Prassidis  05   16 Mon 10:54  SC 1510     322 6666
kearnes  Keith A. Kearnes      06      Mon 10:55  SC 1523     322 6658
mne      Mark Ellingham        09      Mon 09:15  SC 1514     322 6670
tschantz Steven Tschantz       10      Mon 08:13  SC 1507     322 6664
assda    David Assaf IV        p0 2:19 Mon 08:16  SC 1401J    322 6653
Only your current session, on terminal 09, now shows up. -- Mark Ellingham / mne@math.vanderbilt.edu


A VU Math web page, updated July 1997 by webmaster@math.vanderbilt.edu.