who

Print all usernames currently logged on, showing for each user the login name, tty name, the date and time of login, and hostname if not local.

Syntax
      who [-mTuH] [file]
      who am i

Options
   -m    Only print information about the current terminal.
         This is the POSIX way of saying who am i.

   -T    Print a character after the user name indicating the state of the
         terminal line: `+' if the terminal is writable; `-' if it is not;
         and `?' if a bad line is encountered.

   -u    Print the idle time for each user.

   -H    Write column headings above the regular output.

   am I  Returns the invoker's real user name.

   file  By default, who gathers information from the file /var/run/utmp. An
         alternative file may be specified which is usually /var/log/wtmp
         (or /var/log/wtmp.[0-6] depending on site policy as wtmp can grow
         quite large and daily versions may or may not be kept around after
         compression by ac(8)).  The wtmp file contains a record of every
         login, logout, crash, shutdown and date change since wtmp was last
         truncated or created.

If /var/log/wtmp is being used as the file, the user name may be empty or one of the special characters '|', '}' and '~'. Logouts produce an out- put line without any user name. For more information on the special characters, see utmp(5).

“The more the merrier” ~ John Heywood

Related macOS commands

last - indicate last logins of users and ttys.
mesg - display (or do not display) messages from other users.
users - Print login names of users currently logged in.
w - Show who is logged on and what they are doing.


 
Copyright © 1999-2024 SS64.com
Some rights reserved