Pkill
From DikapediaV2
pkill – Kill user session and forcefully logout of the system.
Use the who command to see list of logged in users as follows:
# w
OR
# who
Sample outputs:
root pts/0 Jul 29 13:53 (10.1.6.120) nixcraft pts/1 Jul 29 12:30 (10.1.6.121) sailee pts/2 Jul 29 12:33 (10.1.6.121)
To force and logout nixcraft and sailee user, enter:
# pkill -KILL -u nixcraft # pkill -KILL -u sailee
Alternatively, just try bash and friends kung-fu and save time:
### warning must be run as root or via sudo ### who | awk '!/root/{ cmd="/sbin/pkill -KILL -u " $1; system(cmd)}'
OR
### warning must be run as root or via sudo ### ### Safe version :) ### who | awk '$1 !~ /root/{ cmd="/sbin/pkill -KILL -u " $1; system(cmd)}'