Methods of payment Abuse

How to find out information about sessions in loginctl

06.12.2022, 18:47

We have already talked about what loginctl is and what its syntax is. Now let's look at how to view information about sessions. This task is solved with one simple command. It will not be difficult for you to view all active sessions and get acquainted with the information in the graphical interface.

Find out information about sessions

To find out information about a session, just run one simple command - list-sessions:

$ loginctl list-sessions

It allows you to get acquainted with all active sessions at a given time. As you can see from the screenshot above, there are two active sessions. The first of them is responsible for automatically logging into the GUI when Gnome is running, the second session is a console session in TTY3. We see that in the graphical interface, you can get acquainted only with the session ID, as well as the user name and TTY.

And then how to find out more detailed information about each session? To do this, use the session-status command.

The session in the GUI looks like this:

$ loginctl session-status 1

In this case, we see the moment of the session launch, its type, in the screenshot it is X11. The console session in TTY looks like this:

$ loginctl session-status 3

Need to view session settings without process information? Just do a show-session:

$ loginctl show-session 1

Using this command, you have the opportunity to specify exactly what information you want to get using the -p or --property option.

To get only the type, use the following command:

$ loginctl show-session 1 --p Type

To get only the value, without the name of the property, use the --value option:

$ loginctl show-session 1 --p Type --value

We've looked at how to view session information in loginctl - there's nothing complicated about it.