Print who is currently logged in

      who [options] [file] [am i]


     Print the current user id, name and domain
     (Same as 'who am i')

     Print only the login names and the number of users logged on.
     Overrides all other options.

     Ignored; for compatibility with other versions of 'who'.

     After the login time, print the number of hours and minutes that
     the user has been idle.  '.' means the user was active in last
     minute.  'old' means the user was idle for more than 24 hours.

     Attempt to canonicalize hostnames found in utmp through a DNS
     lookup.  This is not the default because it can cause significant
     delays on systems with automatic dial-up internet access.

     Print a line of column headings.

     After each login name print a character indicating the user’s
     message status:

          +  allowing 'write' messages
          -  disallowing 'write' messages
          ?  cannot find terminal device

The who command differs from whoami in that it provides a list of all users currently logged into the system as well as additional information about each of those users (including login times and terminal numbers). It also differs in that, in the event of a change in ownership of a login session through the use of the su command, it reports the original owner of the session, whereas whoami provides the user name of the effective (i.e., current) owner of the session.

If given no non-option arguments, 'who' prints the following information for each user currently logged on:

login name,
terminal line,
login time,
remote hostname or X display.

If given one non-option argument, 'who' uses that instead of '/var/run/utmp' as the name of the file containing the record of users logged on. '/var/run/wtmp' is commonly given as an argument to 'who' to look at who has previously logged on.

If given two non-option arguments, 'who' prints only the entry for the user running it (determined from its standard input), preceded by the hostname. Traditionally, the two arguments given are 'am i', as in 'who am i'.

“It is awful work this love and prevents all a mans projects of good or glory” ~ Lord Byron

Related Linux commands

groups - Print group names a user is in.
hostname - Print or set system name.
id - Print user and group id’s.
uname - Print system information.
logname - Print current login name.
users - Print login names of users currently logged in.
w - Show who is logged on and what they are doing.
Equivalent Windows command: ECHO %USERNAME% or Quser - Display user sessions on a terminal server.

Copyright © 1999-2024 SS64.com
Some rights reserved