Who Is Logged On To My Computer And What Are They Doing?

CCTV Camera
Monitoring Users.


If you are running a server with multiple users then you might want to know who is logged in and what they are doing.

You can find out all you need to know by typing a single letter and in this guide I will show you which letter it is and the information that is returned.

This guide is useful for people who run servers, virtual machines with multiple users or people who have a Raspberry PI or similar single board computer which they leave on all the time.

Who Is Logged In And What Are They Doing?

All you have to do to find out who is logged in to your computer is type the following letter and press return.


The output from the above command includes a header row and a table of results.

The header row contains the following elements

  • the current time
  • how long the system has been running
  • how many users are currently logged on
  • the system load averages for the past 1, 5 and 15 minutes

The main table has the following columns:

  • login name
  • tty
  • remote host
  • login time
  • idle time
  • JCPU
  • PCPU
  • command line of their current process

JCPU stands for the amount of time used by all of the processes attached to the tty.

PCPU stands for the amount of time used by the current process.

Even on a single user computer the w command can be useful.

For instance I am logged in as gary on my computer but the w command returns 3 rows. Why? I have a tty which is used to run the graphical desktop which in my case is Cinnamon.

I also have 2 terminal windows open.

How To Return The Information Without The Headings

The w command has various switches which can be used. One of them lets you see the information without the headers.

You can hide the headings by using the following command:

w -h

This means you don't see the time, uptime or loads for the 5, 10 and 15 minutes but you can see the users who are logged on and what they are doing.

If you prefer your switches to be reader friendly then the following achieves the same goal.

w --no-header

How To Return The Bare Basic Information

Maybe you don't want to know the JCPU or the PCPU. In fact maybe you just want to know who is logged in, which terminal they are using, what their hostname is, how long they have been idle and what command they are running.

To return just this information use the following command:

w -s

Again you can use the more reader friendly version which is as follows:

w --short

Maybe even that is too much information. Maybe you don't want to know about the hostname either.

The following commands omits the hostname:

w -f

w --from

You can amalgamate a number of switches into one as follows:

w -s -h -f

The above command outputs the short version of the table, no headers and no host name. You could also have expressed the above command as follows:

w -shf

You could also have written it in the following way:

w --short --from --no-header


Find The User's IP Address

By default the w command returns the host name for each user. You can change it so that the ip address is returned instead by using the following commands:

w -i

w --ip-addr

Filtering By User

If you are running a server with hundreds of users or even just a few dozen, it can get fairly busy running the w command on its own.

If you want to find out what a specific user is doing you can specify their name after the w command.

For example if I wanted to find out what gary is doing I can type the following:

w gary


Most of the information provided by the w command can be returned by other Linux commands but none of them require less keystrokes.

The uptime command can be used to show how long your system has been running.

The ps command can be used to show the processes running on a computer

The who command can be used to show who is logged on. the whoami command will show who you are logged on as and the id command will tell you information about a user.

More From Us