loginctl talks to systemd-logind, the session manager, and show-session prints properties of session 2. The -p State filter limits output to that one property, here whether the session is active. Find session numbers with loginctl list-sessions.
Looking for more? Search all 7,657 commands — works offline, in English or Spanish, and fixes typos.