loginctl Command Examples in Linux

loginctl is a command line utility used to manage and control the systemd-logind login manager, which is used to manage user logins and sessions on Linux systems using systemd. It provides a variety of functions, including starting and stopping user sessions, listing active sessions and users, and managing the settings and properties of user sessions.

loginctl is an essential tool for system administrators and developers who need to manage and control the systemd-logind login manager. It provides a flexible and convenient interface for controlling user sessions and managing the settings and properties of the login manager, making it an important part of the systemd system management suite.

loginctl Command Examples

1. Print all current sessions:

# loginctl list-sessions

2. Print all properties of a specific session:

# loginctl show-session session_id --all

3. Print all properties of a specific user:

# loginctl show-user username

4. Print a specific property of a user:

# loginctl show-user username -->
5. Execute a `loginctl` operation on a remote host:
# loginctl list-users -H hostname
Related Post