Windows
Linux
Security & Permissions
Users & Groups
Windows net session / query user equivalent in Linux
Lists currently logged-in users, what they are doing, and recent login history.
Windows
→
net session / query user
Linux equivalents
who / w / last
who / w / last
who / w / last
Overview
What this command does
Lists currently logged-in users, what they are doing, and recent login history.
Migration tip:
w is the most informative — it shows not just who is logged in but the current command they're running and how long they've been idle.Practical tasks
Common use cases
See who is currently logged in
Lists currently logged-in users, what they are doing, and recent login history.
who
Who is currently logged in
w
Logged-in users + what they're doing
last
Login history (most recent first)
Ready to run
Copyable Linux commands
Review paths, device names, package names and permissions before running any command.
who
w
last
sudo lastb
Walkthrough
Examples with explanations
# Windows: query user or net session
who # john pts/0 Jan 15 09:00
w # who + idle time + current command
last # login/logout history
sudo lastb # failed login attempts
Reference
Common options and variations
| Command or option | Use |
|---|---|
who | Who is currently logged in |
w | Logged-in users + what they're doing |
last | Login history (most recent first) |
last -n 20 | Last 20 login events |
sudo lastb | Failed login attempts |
Distro differences
Debian/Ubuntu vs Fedora vs Arch
This command is the same on Debian/Ubuntu, Fedora and Arch Linux when the relevant tool is installed.
| Distribution | Package manager / base | Equivalent command | Difference to notice |
|---|---|---|---|
| Debian/Ubuntu | same command | who / w / last |
Same command on this distribution. |
| Fedora | same command | who / w / last |
Same command on this distribution. |
| Arch | same command | who / w / last |
Same command on this distribution. |
Keep learning