LinuxCommandLibrary

who

TLDR

Show who is logged in

$ who
copy
Show current user only
$ who am i
copy
Show with column headers
$ who -H
copy
Show login time and idle time
$ who -u
copy
Show all available information
$ who -a
copy
Count logged in users
$ who -q
copy
Show system boot time
$ who -b
copy

SYNOPSIS

who [options] [file] [am i]

DESCRIPTION

who displays information about users currently logged into the system. It reads from /var/run/utmp (or another specified file) which tracks login sessions.
The basic output shows username, terminal line, and login time. Additional options reveal idle time, process IDs, and message status (whether the user accepts write/talk messages).
who am i (or whoami) shows information about the current session only, useful for determining your identity especially after su or in scripts.
The command can read historical login data from /var/log/wtmp to show past logins.

PARAMETERS

-a, --all

Print all available information
-b, --boot
Time of last system boot
-d, --dead
Print dead processes
-H, --heading
Print column headers
-l, --login
Print system login processes
-q, --count
Only usernames and count of logged-in users
-r, --runlevel
Print current runlevel
-s
Print only name, line, and time (default)
-T, -w, --mesg
Add user's message status (+, -, ?)
-u, --users
List users logged in
am i
Print only current terminal's user info

CAVEATS

Who shows login sessions, not all user processes. Users may have processes running without active login sessions.
Remote connections may show as pseudo-terminals (pts/N) rather than physical terminals (tty).
The utmp file format varies between Unix systems. Some information may not be available on all platforms.

SEE ALSO

w(1), whoami(1), users(1), last(1), finger(1)

> TERMINAL_GEAR

Curated for the Linux community

BOSGAME Mini PC N95, Intel 12th Mini Computers| 16GB DDR4 RAM| 512GB M.2 2280 SSD| 4K 60HZ Triple Displays by Dual HDMI+Type-C, 6W TDP Quiet Mini PC, WIFI5, BT 5.0 Office

BOSGAME Mini PC N95, Intel 12th Mini Computers| 16GB DDR4 RAM| 512GB M.2 2280 SSD| 4K 60HZ Triple Displays by Dual HDMI+Type-C, 6W TDP Quiet Mini PC, WIFI5, BT 5.0 Office

$239.99
Lenovo Gen 13 ThinkPad X1 Carbon Touchscreen Laptop with Intel Ultra 7 265U Processor, 14" WUXGA 100% sRGB, 32GB DDR5 RAM, 1TB NVMe Performance SSD, FHD+ IR+ RGB Camera, and Windows 11 Pro

Lenovo Gen 13 ThinkPad X1 Carbon Touchscreen Laptop with Intel Ultra 7 265U Processor, 14" WUXGA 100% sRGB, 32GB DDR5 RAM, 1TB NVMe Performance SSD, FHD+ IR+ RGB Camera, and Windows 11 Pro

$1,589.00
Raspberry Pi 5 8GB

Raspberry Pi 5 8GB

$134.50
Copied to clipboard

> TERMINAL_GEAR

Curated for the Linux community

Lenovo Gen 13 ThinkPad X1 Carbon Touchscreen Laptop with Intel Ultra 7 265U Processor, 14" WUXGA 100% sRGB, 32GB DDR5 RAM, 1TB NVMe Performance SSD, FHD+ IR+ RGB Camera, and Windows 11 Pro

Lenovo Gen 13 ThinkPad X1 Carbon Touchscreen Laptop with Intel Ultra 7 265U Processor, 14" WUXGA 100% sRGB, 32GB DDR5 RAM, 1TB NVMe Performance SSD, FHD+ IR+ RGB Camera, and Windows 11 Pro

$1,589.00
Raspberry Pi 5 8GB

Raspberry Pi 5 8GB

$134.50
BOSGAME Mini PC N95, Intel 12th Mini Computers| 16GB DDR4 RAM| 512GB M.2 2280 SSD| 4K 60HZ Triple Displays by Dual HDMI+Type-C, 6W TDP Quiet Mini PC, WIFI5, BT 5.0 Office

BOSGAME Mini PC N95, Intel 12th Mini Computers| 16GB DDR4 RAM| 512GB M.2 2280 SSD| 4K 60HZ Triple Displays by Dual HDMI+Type-C, 6W TDP Quiet Mini PC, WIFI5, BT 5.0 Office

$239.99