In this post i will show on how to display logged in user information and terminal number on Linux server. This post provides practical examples for future references. This steps has been tested on Redhat Linux Enterprise server 6 and may working CentOS server as well.
1. “who am i” command is use to display the username of currently logged.
[[email protected] ~]# who am i root pts/1 2012-04-17 06:14 (192.168.1.52)
2. who command will display all the user currently logged in all terminals.
[[email protected] ~]# who root tty1 2012-04-17 04:29 root pts/0 2012-04-17 04:29 (192.168.1.52) root pts/1 2012-04-17 06:14 (192.168.1.52) root pts/2 2012-04-17 06:01 (192.168.1.52)
3. tty command is used to display the terminal number of currently logged in terminals.
[[email protected] ~]# tty /dev/pts/1
4. The w command shows who is logged in to the system and what they are doing.
[[email protected] ~]# w 06:18:39 up 1:50, 4 users, load average: 0.02, 0.02, 0.00 USER TTY FROM [email protected] IDLE JCPU PCPU WHAT root tty1 - 04:29 1:48m 4.80s 4.78s ping www.google.com root pts/0 192.168.1.52 04:29 1:49m 0.02s 0.02s -bash root pts/1 192.168.1.52 06:14 0.00s 0.05s 0.01s w root pts/2 192.168.1.52 06:01 26.00s 0.11s 0.03s -bash