In previous articles, we talked about what kind of loginctl utility it is, as well as how you can find out information about the process. In this article, we will look at how you can view user information, and, if necessary, switch the process.
You already know how to view all session information, so viewing user information is very similar to this. That is, it is done according to an almost similar principle.
You can view the list of authorized users using the command:
$ loginctl list-users
Using the user-status command, you can find out in detail all the information about any user.
At the same time, you will get acquainted in detail with the details of his session:
$ loginctl user-status 1000
Sessions displays all IDs of all sessions, the current session is marked with a star. Below you can see Systemd and all the services that were started on behalf of the user, as well as all the processes. The list of processes can be shortened.
Use the -l or --full option if you want to see all processes:
$ loginctl user-status 1000 --full
Do you need the utility to output information without pagination?
Use --no-pager:
$ loginctl user-status 1000 --no-pager
Switching to another session
Also, each user has the ability to switch from one session to another using the graphical interface (Gnome or KDE). Would you like to complete a task in the terminal? Use loginctl. To switch to a session with ID 3, apply the command:
$ loginctl activate 3
Then you can switch back. This is more convenient than switching by TTY using hotkeys. After switching, you will lock the screen from the previous session.
Use the session-lock command:
$ loginctl session-lock 1
Now you know even more interesting, useful information about the loginctl program and its capabilities that you can use in your practice.
Apply the discount by inserting the promo code in the special field at checkout: