To see list of logged in user type who or w command:
[root@localhost ~]# who root tty1 2015-07-15 12:00 root pts/0 2015-07-15 12:05 (:0.0) root pts/1 2015-07-15 12:06 (:0.0) root pts/5 2015-07-28 13:26 (150.236.11.171)
[root@localhost ~]# w 13:41:44 up 13 days, 39 min, 4 users, load average: 0.26, 0.50, 0.52 USER TTY FROM LOGIN@ IDLE JCPU PCPU WHAT root tty1 - 15Jul15 13days 0.12s 0.00s /bin/sh /usr/bi root pts/0 :0.0 15Jul15 13days 14:12 0.05s /bin/bash root pts/1 :0.0 15Jul15 13days 7:27 0.02s /bin/bash root pts/5 150.236.11.171 13:26 0.00s 0.06s 0.00s w
Other options
You can pass the following options to the who command (taken from the who command man page):Just open a -a, --all same as -b -d --login -p -r -t -T -u
-b, --boot time of last system boot
-d, --dead print dead processes
-H, --heading print line of column headings
-l, --login print system login processes
--lookup attempt to canonicalize hostnames via DNS
-m only hostname and user associated with stdin
-p, --process print active processes spawned by init
-q, --count all login names and number of users logged on
-r, --runlevel print current runlevel
-s, --short print only name, line, and time (default)
-t, --time print last system clock change
-T, -w, --mesg add user's message status as +, - or ?
-u, --users list users logged in
--message same as -T
--writable same as -T
--help display this help and exit
--version output version information and exit
[root@localhost ~]# who -u root tty1 2015-07-15 12:00 old 2350 root pts/0 2015-07-15 12:05 old 3330 (:0.0) root pts/1 2015-07-15 12:06 old 3330 (:0.0) root pts/5 2015-07-28 13:26 . 7180 (150.236.11.171)
root pts/5 2015-07-28 13:26 . 7180 (150.236.11.171)
[root@localhost ~]# who -a
system boot 2015-07-15 11:59
run-level 3 2015-07-15 11:59
root + tty1 2015-07-15 12:00 old 2350
LOGIN tty2 2015-07-15 12:00 2352 id=2
LOGIN tty3 2015-07-15 12:00 2354 id=3
LOGIN tty4 2015-07-15 12:00 2356 id=4
LOGIN tty5 2015-07-15 12:00 2358 id=5
LOGIN tty6 2015-07-15 12:00 2360 id=6
root + pts/0 2015-07-15 12:05 old 3330 (:0.0)
root + pts/1 2015-07-15 12:06 old 3330 (:0.0)
pts/2 2015-07-28 13:36 0 id=/2 term=0 exit=0
pts/3 2015-07-28 13:35 6303 id=ts/3 term=0 exit=0
pts/4 2015-07-28 13:35 6889 id=ts/4 term=0 exit=0
root + pts/5 2015-07-28 13:26 . 7180 (150.236.11.171)
1009 ps -dN | grep -i pts/2
1010 kill -9 3395
Comments
Post a Comment