who - macOS
Overview
who lists the users currently logged in to the system, along with information about each user’s login time, terminal, and user ID.
Syntax
who [options]
Options/Flags
- -a (All Users): Includes users that are not currently active.
 - -b (Boot Time): Shows the system boot time.
 - -d (Dead Processes): Includes processes that have terminated but have not been reaped by the system.
 - -H (Header): Displays a header with the output.
 - -l (Long Format): Provides more detailed information about each user.
 - -m (Minimal): Displays only the username and login time.
 - -p (Process Information): Shows detailed information about each user’s processes.
 - -q (Quiet): Suppresses most output.
 - -s (Short Format): Displays only the username, login time, and terminal.
 - -t (Time Format): Allows you to specify the format of the time that is displayed.
 
Examples
- List all logged-in users in short format:
 
who -s
- Show detailed information for each user:
 
who -l
- List all users, including inactive ones:
 
who -a
- Display the system boot time and user login times:
 
who -b
Common Issues
- If no options are specified, who defaults to the -s (short format) output.
 - Inactive users may not be displayed if the -a (All Users) option is not used.
 - The -t (Time Format) option requires a valid time format string.
 
Integration
who can be integrated with other commands to perform more complex tasks:
- Use who | grep to search for specific users.
 - Combine who with ps to get a list of all processes associated with a particular user.
 - Write scripts that use who‘s output to trigger actions based on the number or type of logged-in users.
 
Related Commands
- users – Lists active users and information about their login time and terminal.
 - finger – Provides detailed information about a specific user.
 - last – Shows a history of logins and logouts.