who

who linux command cheatsheet by Thamizhiniyan C S

Introduction

This command is used to show who is logged on.


Syntax

who [OPTION]... [ FILE | ARG1 ARG2 ]


Important Flags

FlagDescription

-a, --all

Print all information provided by -b, -d, --login, -p, -r, -t, -T, -u options.

-b, --boot

Display the time of the last system boot.

-d, --dead

Print dead processes.

-H, --heading

Print a line of column headings.

--ips

Print IPs instead of hostnames. With --lookup, canonicalizes based on stored IP, if available, rather than stored hostname.

-l, --login

Print system login processes.

--lookup

Attempt to canonicalize hostnames via DNS.

-m

Display only hostname and user associated with stdin.

-p, --process

Print active processes spawned by init.

-q, --count

Print all login names and the number of users logged on.

-r, --runlevel

Print the current runlevel.

-s, --short

Print only name, line, and time (default).

-t, --time

Print the last system clock change.

-T, -w, --mesg

Add user's message status as +, - or ?.

-u, --users

List users logged in.

--message

Same as -T.

--writable

Same as -T.

--help

Display help information and exit.

--version

Output version information and exit.


Examples

CommandDescription

Display a list of the logged-in usernames.

Achieve the same effect as 'who' with the short format.

Print column headers above the list of users.

Display information about the current user only.

Show a list of available terminals.

Display the time of the last system boot.

List the usernames and the number of users currently logged on.

Show the user's message status.

Print a list of active processes spawned by init.

Print a list of dead processes.

Display the current runlevel of the system.

Print the last time the system clock was changed.

Show how long each user has been idle.

Print all information provided by various options in a single output.

Last updated