Skip to content

MacOS w bash

The w command in MacOS is used to display information about the users currently logged into the system, including their login time, current activity, and system load. It shows details such as the user’s name, terminal they are using, remote host if applicable, login time, idle time, JCPU (total time used by all processes attached to the tty), PCPU (total time consumed by the current process), and what command or program the user is running. This command can be useful for administrators to monitor user activity and system resource usage.

w Syntax:

Terminal window
w [options] [user]

Options:

OptionDescription
-hDisplays a help message
-sShort format output
-lLong format output
-vDisplay version information

Parameters:

ParameterDescription
userSpecifies the username to filter the output for. If not provided, all users are shown.

w Usage:

Display information about currently logged-in users

Terminal window
w

The w command without any arguments will display information about currently logged-in users.

Display information for a specific user

Terminal window
w username

Replacing “username” with the actual username will display information specifically for that user.

Display information including login times

Terminal window
w -i

Using the -i option with w will include login times in the output.

Display information in full format

Terminal window
w -f

The -f option will display information in full format including from where the user is logged in.

Common Questions on w Usage:

How do I use w in MacOS?

To use the w command in MacOS, execute the following command:

Terminal window
w

What option displays the current time when using w in MacOS?

To display the current time along with the users who are currently logged in when using w in MacOS, you can use the -o option:

Terminal window
w -o

How can I get a detailed output of the w command in MacOS?

To get a detailed output with information about the users’ login times, CPU usage, and more when using w in MacOS, you can use the -f option:

Terminal window
w -f

How do I see information about idle time using w in MacOS?

To view information about idle time, which represents how long a user has been inactive, when using the w command in MacOS, you can use the -i option:

Terminal window
w -i

How can I show IP addresses along with user information in w on MacOS?

To display IP addresses along with user information when using w in MacOS, you can use the -a option:

Terminal window
w -a

How do I filter the output of the w command by username in MacOS?

To filter the output to show information specific to a particular user when using w in MacOS, you can use the -u option followed by the username:

Terminal window
w -u username

How can I customize the time format in the w command output on MacOS?

To customize the time format displayed in the output of the w command in MacOS, you can use the -T option followed by the desired time format (e.g., 12-hour or 24-hour):

Terminal window
w -T 12

Applications of the w command

  • Display a list of currently logged in users
  • Show information about the users’ activities
  • Provide details on the load average and uptime of the system