Skip to content

loginctl

Control the elogind login manager


To check how many sessions are created by user

  • loginctl list-sessions works the same as below
loginctl

Show all properties of a session

loginctl show-session <session> -a

Show properties of a specific user

loginctl show-user <username>

Show a specific property of a user

loginctl show-user <username> -p Property

Execute on a remote host

loginctl list-users -H hostname

List users who is currently active

loginctl list-users

Log out a user from all sessions

loginctl terminate-user <username>

Lock all sessions

loginctl lock-sessions

Dump how long time our user has been online

loginctl user-status

Querying user status

loginctl user-status

To check the parameters defined for the session. Below are the default settings

loginctl show-session

Show loginctl with clean output

loginctl --no-legend list-sessions

Terminate user

loginctl terminate-user

Kill user session

loginctl kill-session <session>

Kill user

loginctl kill-user <username>

Show user login status (example) where 6 is session number

loginctl session-status 6
6 - wuseman (1000)
  Since: Thu 2026-01-22 20:43:08 CET; 1 day 16h ago
  State: online
 Leader: 3723 (login)
   Seat: seat0; vc1
    TTY: tty1
 Remote: no
Service: login
   Type: tty
  Class: user
   Idle: yes since Thu 2026-01-22 20:43:52 CET (1 day 16h ago)

Lock login session

loginct lock-session <session number>

Activate linger for a user (systemd only)

loginctl enable-linger myuser

Disable linger for a user (systemd only)

loginctl disable-linger myuser

Dump wich tty we are using

loginctl show-session "$(loginctl | awk 'NR==2 {print $1}')" -p Type -p Display -p TTY

Screen unlock one or more sessions

Screenshot

  • When this happens you must go to commandline and press `ctrl+alt+ยด to be able to login from commandline and unlock the session
loginctl-unlock session <session_number_from_picture>

List seats

loginctl list-seats

Show seat status

loginctl seat-status seat0

Show proertties of seats or the manager

loginctl show-seat seat0

Powerfoff system

loginctl poweroff    

Reboot system

loginctl reboot