How To Check Current Logged Users List In UNIX/Linux/CentOS

Tuesday, January 21, 2014

How To Check Current Logged Users List In UNIX/Linux/CentOS :-

How to get user names from currently logged in users to the current OS like UNIX / Linux / CentOS server fusing command prompt ?

there are three commands :-
1. w command
   above command shows the information about the users which all currently on the machine, and their processes.
2. who command
   above command shows the information about users who all are currently logged in.

3. users command
   above command shows the login names of the users currently on the system, in sorted order, space separated, on a single line. It reads all information from /var/run/utmp file.

Example :- 

Open a terminal or login into remote server using ssh command and type the following commands.

w command

Type the w command on your command prompt :

# w

Sample Output :

17:52:45 up 5 days, 22:11,  1 user,  load average: 0.06, 0.02, 0.00
USER     TTY      FROM              LOGIN@   IDLE   JCPU   PCPU WHAT
test pts/0    106.219.50.199   17:22    0.00s  0.03s  0.01s sshd: test [priv]
anuj pts/0    106.219.50.199   17:22    0.00s  0.03s  0.01s sshd: anuj[priv]


To see info about a user named anuj, enter:
# w anuj


who command

Type the who command on your command prompt :

# who

Sample Output :

root pts/0        2014-01-21 17:22 (106.219.50.199)
anuj pts/0        2014-01-21 17:22 (106.219.50.199)


To see info about a user named anuj, enter:
# w anuj

Pass the -a option to who command:
# who -a

Sample Output :-

 system boot  2014-01-15 19:41
           run-level 3  2014-01-15 19:41
LOGIN      tty2         2014-01-15 19:41              1930 id=2
LOGIN      tty6         2014-01-15 19:41              1938 id=6
LOGIN      tty4         2014-01-15 19:41              1934 id=4
LOGIN      tty1         2014-01-15 19:41              1928 id=1
LOGIN      tty3         2014-01-15 19:41              1932 id=3
LOGIN      tty5         2014-01-15 19:41              1936 id=5
root + pts/0        2014-01-21 17:22   .        101828 (106.219.50.199)
           pts/1        2014-01-20 16:49             86934 id=ts/1  term=0 exit=0
           pts/2        2014-01-17 18:50             47837 id=ts/2  term=0 exit=0


users command

Open a terminal or login over the ssh session and enter the following command:
# users

Sample outputs:

anuj test micky rony





0 comments:

About This Blog

Lorem Ipsum

  © Copyright 2009 Linux-HelpLine.Blogspot.com

Back to TOP