The w
command in Bash is used to display information about users currently logged into the system and their activities. It provides details such as the username, the terminal they are using, their login time, idle time, and the command they are currently executing.
The basic syntax of the w
command is as follows:
w [options] [user]
-h
: Suppresses the header line.-s
: Displays the output in a shorter format.-f
: Shows the full login name of the users.-u
: Displays the user’s idle time in a more human-readable format.w
w -h
w -s
w -f
john
):
w john
w
regularly to monitor system usage and identify active users.w
with other commands like grep
to filter results for specific users or activities.