If you want to know which users are currently logged in to your Linux system, which console they're using, and the date and time they logged in, issue the who command. You'll see output something like this:
who
root tty1 Nov 2 17:57
hermie tty3 Nov 2 18:43
sigmund tty2 Nov 2 18:08
In the output shown here, the term tty stands for teletype. In the olden days of computing, a terminal was just a keyboard with an attached printer, so you read everything off the teletype.
If you've logged in with multiple virtual consoles and changed your identity on any of them, you may have some trouble figuring out who you are--or at least what user is logged in to the console you're using. If you find yourself in such an identity crisis, try this related command:
whoami
The whoami command will tell you the name of the current user. Just as a side note, you can also use the who am i command (a variant of the who command) to return the name of the current user. But it doesn't always work s you might expect. If you're logged in as root, and use the su command to switch to another user, who am i will return "root" as the current user. For this reason, I recommend that you train yourself to always use the whoami command when you want to know the current user name.
For more information on the who command, see the who manual.
Previous Lesson: Switching Users
Next Lesson: Date and Time
Comments - most recent first
|
|
||
![]() |