CompTIA Linux+ (XK0-005) — Question 275
Before a Linux administrator restarts a system using systemd, the administrator wants to know if any of the server users are currently logged in. Which of the following commands should the administrator use to verify that the server is not being used?
Answer options
- A. loginctl list-sessions
- B. journalctl -u
- C. systemctl status user-sessions
- D. systemd --user
Correct answer: A
Explanation
The command 'loginctl list-sessions' provides a list of active user sessions, making it the appropriate choice for checking logged-in users. The other options do not specifically show user sessions; 'journalctl -u' relates to viewing logs of a specific unit, 'systemctl status user-sessions' is not a valid command, and 'systemd --user' is used for managing user services, not checking logins.