1# User Sessions {#sec-user-sessions}
2
3Systemd keeps track of all users who are logged into the system (e.g. on
4a virtual console or remotely via SSH). The command `loginctl` allows
5querying and manipulating user sessions. For instance, to list all user
6sessions:
7
8```ShellSession
9$ loginctl
10 SESSION UID USER SEAT
11 c1 500 eelco seat0
12 c3 0 root seat0
13 c4 500 alice
14```
15
16This shows that two users are logged in locally, while another is logged
17in remotely. ("Seats" are essentially the combinations of displays and
18input devices attached to the system; usually, there is only one seat.)
19To get information about a session:
20
21```ShellSession
22$ loginctl session-status c3
23c3 - root (0)
24 Since: Tue, 2013-01-08 01:17:56 CET; 4min 42s ago
25 Leader: 2536 (login)
26 Seat: seat0; vc3
27 TTY: /dev/tty3
28 Service: login; type tty; class user
29 State: online
30 CGroup: name=systemd:/user/root/c3
31 ├─ 2536 /nix/store/10mn4xip9n7y9bxqwnsx7xwx2v2g34xn-shadow-4.1.5.1/bin/login --
32 ├─10339 -bash
33 └─10355 w3m nixos.org
34```
35
36This shows that the user is logged in on virtual console 3. It also
37lists the processes belonging to this session. Since systemd keeps track
38of this, you can terminate a session in a way that ensures that all the
39session's processes are gone:
40
41```ShellSession
42# loginctl terminate-session c3
43```