In many unix books most of us have read these words or commands whoami and who am i..These commands are useful when you work in an environment where people have different login ids and you are using sudo access or are first logging thorugh a different name and then switching to another user.
suppose i login with username joe and then i use su - to switch to user pam. Now if i will use the command
$id
joe gid() uid()
$su - pam
password: *******
$
$id
pam gid() uid()
ok...now i will use whoami
$whoami
pam
ok and now i use who am i
$who am i
joe
So you see the difference. its very clear from the example.
Sometimes you might see many screens open, but you really don't know who had initially logged into the system . At that time these commands are very handy.
No comments:
Post a Comment