loginctl(1)
Control the systemd login manager to inspect and manage user logins, sessions, and seats.
Synopsis
loginctl [OPTIONS...] {COMMAND} [NAME...]Description
loginctl is a utility for introspecting and controlling the state of the systemd login manager (logind). It can be used to examine logged-in users and sessions, manage user sessions and seats, and control system power state. The login manager tracks user logins, sessions, and the hardware seats they are attached to.
Most operations require appropriate permissions; regular users can typically query information about their own sessions, while privileged operations like terminating sessions or changing power state require root or appropriate polkit authorization.
Common options
| Flag | What it does |
|---|---|
-p, --property=NAME | When showing session/user/seat properties, limit output to specified property names |
-a, --all | Show all properties and sessions, including empty ones |
-l, --full | Do not truncate output to fit terminal width |
-n, --lines=INTEGER | Number of journal lines to show when displaying session logs |
--output=FORMAT | Control output format; use 'json' or 'json-pretty' for machine-readable output |
-H, --host=HOST | Execute operation on remote host (requires SSH access) |
-M, --machine=NAME | Execute operation on local container or machine |
--no-pager | Do not pipe output into a pager; show all output directly |
--no-legend | Do not show column headers and footers in output |
-q, --quiet | Suppress normal output; useful for scripting |
Examples
List all active user sessions on the system
loginctl list-sessionsDisplay all users currently logged in
loginctl list-usersDisplay detailed properties of session number 2
loginctl show-session 2Show properties and sessions for a specific user
loginctl show-user usernameDisplay status and devices for a hardware seat
loginctl seat-status seat0Terminate a specific user session immediately
loginctl terminate-session 5Lock the current session (suspend screensaver/lock screen)
loginctl lock-sessionPower off the system (equivalent to shutdown -h now)
loginctl poweroff