Monday, October 20, 2014

identify yourself in linux



whoami

The whoami command tells you your username.
[root@LINUX ~]# whoami
root
[root@LINUX ~]# su - paul
[paul@LINUX ~]$ whoami
Paul

Who

The who command will give you information about who is logged on the system.
[paul@LINUX ~]$ who
root tty1 2008-06-24 13:24
sandra pts/0 2008-06-24 14:05 (192.168.1.34)
paul pts/1 2008-06-24 16:23 (192.168.1.37)

who am i

With who am i the who command will display only the line pointing to your current
session.
[paul@LINUX ~]$ who am i
paul pts/1 2008-06-24 16:23 (192.168.1.34)

w

The w command shows you who is logged on and what they are doing.
$ w
05:13:36 up 3 min, 4 users, load average: 0.48, 0.72, 0.33
USER TTY FROM LOGIN@ IDLE JCPU PCPU WHAT
root tty1 - 05:11 2.00s 0.32s 0.27s find / -name shad
inge pts/0 192.168.1.33 05:12 0.00s 0.02s 0.02s -ksh
paul pts/2 192.168.1.34 05:13 25.00s 0.07s 0.04s top

id

The id command will give you your user id, primary group id, and a list of the groups that you belong to.

root@linux:~# id
uid=0(root) gid=0(root) groups=0(root)
root@linux:~# su - brel
brel@linux:~$ id
uid=1001(brel) gid=1001(brel) groups=1001(brel),1008(chanson),11578(wolf)

No comments:

Post a Comment