Whoami

From DikapediaV2
Revision as of 14:37, 11 September 2024 by Ardika Sulistija (talk | contribs) (Created page with "https://www.thegeekstuff.com/2009/03/4-ways-to-identify-who-is-logged-in-on-your-linux-system/ <b>whoami</b> command is used to print the loggedin user name. $ whoami john <b>whoami</b> gives the same output as <b>id -un</b> as shown below: $ id -un john <b>whoami</b> command will display the logged-in user name and current tty details. The output of this command contains the following columns: logged-in user name, tty name, current time with date and ip-address...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

https://www.thegeekstuff.com/2009/03/4-ways-to-identify-who-is-logged-in-on-your-linux-system/

whoami command is used to print the loggedin user name.

$ whoami
john

whoami gives the same output as id -un as shown below:

$ id -un
john

whoami command will display the logged-in user name and current tty details. The output of this command contains the following columns: logged-in user name, tty name, current time with date and ip-address from where this users initiated the connection.

$ who am i
john     pts/2        2009-03-28 23:04 (dev-db-server)

$ who mom likes
john     pts/2        2009-03-28 23:04 (dev-db-server)

$ who mom hates
ec2-user pts/0        2020-06-15 05:43 (ip68-100-237-178.dc.dc.cox.net)

$ who -m

saml pts/1 2014-01-06 09:44 (:0)

$ who likes candy
saml     pts/1        2014-01-06 09:44 (:0)

$ who eats cookies
saml     pts/1        2014-01-06 09:44 (:0)
 
$ who blah blah
saml     pts/1        2014-01-06 09:44 (:0)

Warning: Don't try "who mom hates" command.

Also, if you do su to some other user, this command will give the information about the logged in user name details.