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
who

Display a list of the logged-in usernames.

who -s

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

who -H

Print column headers above the list of users.

who -m

Display information about the current user only.

who -l

Show a list of available terminals.

who -b

Display the time of the last system boot.

who -q

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

who -T

Show the user's message status.

who -p

Print a list of active processes spawned by init.

who -d

Print a list of dead processes.

who -r

Display the current runlevel of the system.

who -t

Print the last time the system clock was changed.

who -u

Show how long each user has been idle.

who -a

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

Last updated