Skip to main content

For what reason would you need to find the identity of the current user? You are the current user!  However, if you are like me and run multiple user accounts for different domains, then having the ability to quickly check is important.


The output from who gives you the name of the current user (denoted below as {username}), the terminal they are logged in at, the date and time when they logged in and the IP address:

{username} pts/0       2020-09-03 11:04 (ip address)


Whereas, whoami returns the short by direct response:


The w command provides us with not only the user name, but a bunch of extra details. Multiple users will all be listed with the w command. At the time of performing command w, I had three shell windows open... so yes I had three users listed.  pts/0, pts/1 and pts/2 were in order of the log in.

The w command provides the boot time, uptime and average load for the previous five, ten and fifteen minutes, and the following information regarding the current user.

USER The user name
TTY The type of terminal they are logged in at. This will usually be a pts (a pseudo-teletype). :0 means the physical keyboard and screen connected to this computer
FROM The name of the remote host if this is a remote connection
LOGIN@ The time at which the user logged in
IDLE Idle time
JCPU Joint CPU time, this is the CPU time used by all processes that have been attached to this TTY
PCPU Process CPU time, this is the CPU time used by the current process. The current process is named in the WHAT column
WHAT The command line of this user’s current process

Clearly we now know who this user is... a little bit over board.  Nevertheless, we know the user.  If for some reason you want a little more detail about a specific user then use the id command

id {username}