Inspect and Manage Login Sessions with loginctl

loginctl lists active sessions and users on a systemd system and can terminate a hung session through systemd-logind.

LinuxsystemdsessionsloginctlLow risk
Run `loginctl list-sessions` to list sessions, then `sudo loginctl terminate-session SESSION_ID` to end one.

01Command

Command
$ loginctl list-sessions

02What it does

`loginctl show-session <id>` reveals details such as the remote host, TTY, and whether the session is graphical. `loginctl list-users` and `loginctl user-status <user>` show per-user state and cgroups. Because termination goes through systemd-logind, it cleans up the session's scope properly — a safer equivalent of killing the user's processes by hand.

03Risk

RiskLow risk
Requirementssystemd-based distribution

04Undo

✓No undo needed — this command does not change persistent state.

05Sources

  • loginctl(1) - Linux manual page
    Ubuntu Manpages · technical · 2026-09-17
    Evidence: loginctl may be used to enumerate and inspect sessions, and terminate-session ends the specified session.

Last verified: 2026-09-17 · Category: System & Settings

06Related solutions