0
0
Linux CLIscripting~20 mins

systemctl for service management in Linux CLI - Practice Problems & Coding Challenges

Choose your learning style9 modes available
Challenge - 5 Problems
🎖️
Systemctl Service Master
Get all challenges correct to earn this badge!
Test your skills under time pressure!
💻 Command Output
intermediate
2:00remaining
What is the output of checking a service status?
You run the command systemctl status sshd on a Linux system where the SSH service is active and running. What will the command output include?
Linux CLI
systemctl status sshd
AActive: active (running) since [date and time]; shows process ID and memory usage
BActive: inactive (dead); no process ID shown
CFailed to start sshd.service: Unit sshd.service not found.
DActive: activating (start) since [date and time]; no process ID shown
Attempts:
2 left
💡 Hint
Think about what 'active and running' means for a service status.
💻 Command Output
intermediate
2:00remaining
What happens when you disable a service?
You run systemctl disable apache2 on a Linux system. What is the immediate effect of this command?
Linux CLI
systemctl disable apache2
AThe apache2 service is masked and cannot be started manually.
BThe apache2 service is restarted immediately.
CThe apache2 service is stopped immediately.
DThe apache2 service is prevented from starting automatically on boot.
Attempts:
2 left
💡 Hint
Disabling a service affects its behavior on system startup.
📝 Syntax
advanced
2:00remaining
Which command correctly restarts a service immediately?
You want to restart the nginx service immediately using systemctl. Which command is correct?
Asystemctl enable nginx.service
Bsystemctl restart nginx.service
Csystemctl reload nginx.service
Dsystemctl stop nginx.service && systemctl start nginx.service
Attempts:
2 left
💡 Hint
Restart means stop and start in one command.
💻 Command Output
advanced
2:00remaining
What error appears when starting a non-existent service?
You run systemctl start foobar where no service named 'foobar' exists. What error message will systemctl show?
Linux CLI
systemctl start foobar
AFailed to start foobar.service: Unit foobar.service not found.
Bfoobar.service started successfully.
CPermission denied while starting foobar.service.
Dfoobar.service is already running.
Attempts:
2 left
💡 Hint
Think about what happens if the service file is missing.
🚀 Application
expert
2:00remaining
How to check which services are enabled at boot?
You want to list all services that are enabled to start automatically at boot on a Linux system using systemctl. Which command will give you this list?
Asystemctl list-units --type=service --state=running
Bsystemctl status --all
Csystemctl list-unit-files --state=enabled
Dsystemctl show --property=Enabled
Attempts:
2 left
💡 Hint
Look for a command that lists unit files filtered by enabled state.