I have Linux servers. There is a lot of different remote connection services like ssh, telnet, vnc, X11, konsole etc. I want to learn who is logged currently. And get details like connection way, connection time ip address etc. These information may become very crusuial. There different commands to get this information.
Use w For Connected Users
We can simple and fastly issue w command to get connected users.
12:15:59 up 4:57, 1 user, load average: 0.00, 0.01, 0.05
USER TTY FROM LOGIN@ IDLE JCPU PCPU WHAT
root pts/ gateway 07:20 7.00s 0.04s 0.00s w
- We use w as a command
- USER is the username
- TTY is connection type
- FROM is ip address of client
There are different information about the system performance too.
who Command To Get Connected Users
We have alternative command who which is similar to w
root pts/ 2016-11-07 07:20 (gateway)
Get All Logins and Login Screens Waiting For User
We can get logged in users and get login screen with who commands -a parameter.
system boot 2016-11-07 07:18
LOGIN ttyS0 2016-11-07 07:18 525 id=tyS0
LOGIN tty1 2016-11-07 07:18 564 id=tty1
root + pts/ 2016-11-07 07:20 . 1898 (gateway)
run-level 3 2016-11-07 07:24