Site Menu

Share

LINUX CLASSES - LINUX COMMANDS

Who is Logged In?

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

[ RETURN TO INDEX ]


   

Comments - most recent first
(Please feel free to answer questions posted by others!)

Hossein Ayazi     (15 Dec 2011, 02:02)
how i found List's users?
Majed     (08 Aug 2011, 08:41)
thanks for the tips about who am i command because it happened to me. i logged in to another user and it printed an output as if i issued only "who"
Grace Kimani     (23 Feb 2011, 00:38)
Absolutely informative !
pradeep     (06 Sep 2010, 16:42)
Its simply superb!!. It would be great if I get a mail/notification whenever this pages gets updated. Thanks in advance.
jnlickey     (02 Jun 2010, 09:44)
Download or send in for a free CD for Ubuntu 9.10 or 10.0 and dual boot it with MS Windows. Also you can download Linux Mint or Fedora 12 or 13 and there is a neat little application (Fedora LiveUSB Creator) that you can download to install it on a USB drive as well. Once you download the iso file just burn it to a CD/DVD or use the application to install it to a USB thumb drive. Then boot up your computer with the USB or CD/DVD and then start using and learning linux. Thats what I am doing.
Also this is a great tutorial - thank you Bob for making it for all of us newbie's!
Rsingh36     (02 Jun 2010, 07:37)
This site is simply great......also,pls let me know if there is any website where we can have hands on practice for Linux commands and simple shell scipting...


I welcome your comments. However... I am puzzled by many people who say "Please send me the Linux tutorial." This website *is* your Linux Tutorial! Read everything here, learn all you can, ask questions if you like. But don't ask me to send what you already have. :-)

NO SPAM! If you post garbage, it will be deleted, and you will be banned.
*Name:
Email:
Notify me about new comments on this page
Hide my email
*Text:
 
 


Ask Bob Rankin - Free Tech Support


Copyright by - Privacy Policy
All rights reserved - Redistribution is allowed only with permission.