Of course, if you’re on a system with multiple users, or you’re logged into the box with multiple connections, using the above method and searching through a huge tree of processes trying to figure out which is which will not be fun. Here’s another way of doing it: Looking at the output from the w
command above, we can see that the idle users’ TTY is pts/0
so now all we need is the PID for the parent process. We can find that by running who -all | grep raam
:
Here we can see that 18076
is the PID for the parent process of pts/0
, so once we issue kill -1 18076
that idle session will be gone!
https://raamdev.com/2007/kill-inactive-and-idle-linux-users/