How to identify a user account in Linux

Linux Basic Introduction To Users

Into this tutorial we will learn how to identify a user account or who is logged into system with commands like who or who am i.

If multiple users use a single system, then everyone may have their own user account. At this time, it will be helpful to know who is logged in and the user account details.
  • Whoami :

To know about the system's username use the above command.
Syntax:
# whoami 


[pooja@linuxelearn /]$ whoami
pooja
[pooja@linuxelearn /]$

Check into the above table , 'pooja' is our system username.
  • who:

To check the information about the users logged on to the system use the following command.
Syntax:
# who


[root@linuxelearn ~]# who
root     tty1         2017-02-02 21:12 (:0)
root     pts/0        2017-02-02 21:15 (:0.0)
root     pts/1        2017-02-02 23:19 (192.168.43.250)
[root@linuxelearn ~]#

  • who am I :

This command will show the information about the current user only.
Syntax:
# who am i 


[root@linuxelearn ~]# who am i
root     pts/1        2017-02-02 23:19 (192.168.43.250)
[root@linuxelearn ~]#


Check at the above table, it is displaying current logged in user in our system is root.

  • w

Using this command we can see about the users who are logged in and what are they doing.
Syntax is :
# w


[pooja@linuxelearn /]$ w
 23:26:39 up  2:22,  3 users,  load average: 0.00, 0.00, 0.00
USER     TTY      FROM              LOGIN@   IDLE   JCPU   PCPU WHAT
root     tty1     :0               21:12    2:22m  8.67s  8.67s /usr/bin/Xorg :
root     pts/0    :0.0             21:15    2:10m  0.06s  0.06s /bin/bash -l
root     pts/1    192.168.43.250   23:19    1.00s  0.91s  0.48s w
[pooja@linuxelearn /]$


  • id

This command used for to check your user id, primary group id, and a list of groups that belongs to that user.
Syntax is :
Id


[pooja@linuxelearn /]$ id
uid=503(pooja) gid=508(pooja) groups=508(pooja),504(ram),505(rpgroup) context=unconfined_u:unconfined_r:unconfined_t:s0-s0:c0.c1023
[pooja@linuxelearn /]$


I hope you enjoyed reading this article….




Post a Comment