Who command in Linux?

Who Command in Linux: A Comprehensive Guide

The who command in Linux is a powerful tool that provides information about the users and groups on a system. It is a fundamental command that helps you manage and monitor system resources, including user accounts, group memberships, and permissions. In this article, we will delve into the world of who command, exploring its syntax, options, and usage.

Syntax of the Who Command

The basic syntax of the who command is as follows:

who [options] [user]

  • who: This is the command itself.
  • [options]: You can add one or more options to the command. Some common options include:

    • -h: Display the help message.
    • -a: Display the list of users and groups.
    • -u: Display the user’s username.
    • -g: Display the user’s group membership.
    • -l: Display the list of users and groups in a long format.
    • -n: Display the list of users and groups in a numbered format.
    • -p: Display the list of users and groups in a pipe format.
    • -s: Display the list of users and groups in a sorted format.
    • -t: Display the list of users and groups in a tabular format.
    • -u: Display the user’s username.
    • -g: Display the user’s group membership.
    • -a: Display the list of users and groups.
    • -l: Display the list of users and groups in a long format.
    • -n: Display the list of users and groups in a numbered format.
    • -p: Display the list of users and groups in a pipe format.
    • -s: Display the list of users and groups in a sorted format.
    • -t: Display the list of users and groups in a tabular format.
  • user: This is the username for which you want to display information.

Options of the Who Command

Here are some of the most commonly used options of the who command:

  • -h: Display the help message.
  • -a: Display the list of users and groups.
  • -u: Display the user’s username.
  • -g: Display the user’s group membership.
  • -l: Display the list of users and groups in a long format.
  • -n: Display the list of users and groups in a numbered format.
  • -p: Display the list of users and groups in a pipe format.
  • -s: Display the list of users and groups in a sorted format.
  • -t: Display the list of users and groups in a tabular format.
  • -u: Display the user’s username.
  • -g: Display the user’s group membership.
  • -a: Display the list of users and groups.
  • -l: Display the list of users and groups in a long format.
  • -n: Display the list of users and groups in a numbered format.
  • -p: Display the list of users and groups in a pipe format.
  • -s: Display the list of users and groups in a sorted format.
  • -t: Display the list of users and groups in a tabular format.

Displaying User Information

To display user information, you can use the following options:

  • -u: Display the user’s username.
  • -g: Display the user’s group membership.
  • -a: Display the list of users and groups.
  • -l: Display the list of users and groups in a long format.
  • -n: Display the list of users and groups in a numbered format.
  • -p: Display the list of users and groups in a pipe format.
  • -s: Display the list of users and groups in a sorted format.
  • -t: Display the list of users and groups in a tabular format.

Displaying Group Information

To display group information, you can use the following options:

  • -g: Display the user’s group membership.
  • -a: Display the list of users and groups.
  • -l: Display the list of users and groups in a long format.
  • -n: Display the list of users and groups in a numbered format.
  • -p: Display the list of users and groups in a pipe format.
  • -s: Display the list of users and groups in a sorted format.
  • -t: Display the list of users and groups in a tabular format.

Displaying User and Group Information in a Tabular Format

To display user and group information in a tabular format, you can use the following options:

  • -t: Display the list of users and groups in a tabular format.
  • -u: Display the user’s username.
  • -g: Display the user’s group membership.
  • -a: Display the list of users and groups.
  • -l: Display the list of users and groups in a long format.
  • -n: Display the list of users and groups in a numbered format.
  • -p: Display the list of users and groups in a pipe format.
  • -s: Display the list of users and groups in a sorted format.

Example Usage of the Who Command

Here’s an example of how to use the who command:


$ who
root root root Mon Jan 1 12:00:00 2024 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

Unlock the Future: Watch Our Essential Tech Videos!


Leave a Comment

Your email address will not be published. Required fields are marked *

Scroll to Top