How can I find out who is logged on my UNIX / Linux system?

by on January 17, 2006 · 6 comments· LAST UPDATED October 2, 2007

in , ,

Q. How do I display who is on the UNIX / Linux system?

A. On a Linux (on Solaris/FreeBSD or any other UNIX) system, many users will be sharing the same server.

Users will use telnet (outdated and insecure) or ssh (secure and highly recommended) to login remotely.

So if you want to find out your friend or a coworker is logged in or not, use the following commands.

If you want to find out who's logged in on the Linux server including what time they logged in and from which network computer then you can use who command:

who command ~ show who is logged on

who commands works with almost all Linux and UNIX like oses. It show who is logged on to your system. It displays information about currently logged in users. By default, this includes the login name, tty name, date and time of login and remote hostname if not local.
$ who
Output:

raj     ttypV    Jan 17 07:23   .     (192.168.1.10)
ben     ttypW    Jan 17 07:42   .     (192.168.1.11)
miku    ttypX    Jan 17 07:28   .     (user-del-net-202.vsnl.net.in)
root    ttypY    Jan 17 04:11   .     (196.15.183.151)
roomy   ttyq0    Jan 17 07:32   .     (org-rev-1.bsnl.net.in)
anita   ttyq2    Jan 17 07:33   .     (192.168.5.112)
gads    ttyq3    Jan 17 07:40   .     (gtw-1.nixcraft.in)
bencs   ttyq5    Jan 17 07:44   .     (dsl5.bsnl.co.in)
pol20um ttyq6    Jan 17 07:47   .     (gtw-2.nixcraft.co.in)

Sometime you just want to find out if user raj logged in or not then you can use grep command:

$ who | grep raj

Try out following command if you have more than 20+ users logged in (so that you can see one page of logged in users at a time):

$ who | less
$ who | more
TwitterFacebookGoogle+PDF versionFound an error/typo on this page? Help us!

{ 6 comments… read them below or add one }

1 liam April 26, 2007 at 10:04 am

very helpful

Reply

2 Aitor September 27, 2010 at 1:40 pm

Yeah, thank you!

Reply

3 jerome nicholas February 12, 2011 at 5:18 pm

nice :)
command w does the same thing

Reply

4 mica February 25, 2011 at 4:42 pm

What could be the reason for the ‘uptime’ cmd to report more users logged in as opposed to the number of users in the ‘w’ cmd’s list of logged in users?

Reply

5 surendra June 8, 2012 at 8:42 pm

superrb……

Reply

6 sunil March 20, 2014 at 7:44 am

very simple……. thanks

Reply

Leave a Comment

Tagged as: , , , ,

Previous Faq:

Next Faq: