systemd is a system and service manager for Linux. It starts and manages system services during boot and while the system runs.
Click to reveal answer
beginner
What is a unit in systemd?
A unit is a configuration file that describes a service, socket, device, or other resource that systemd manages.
Click to reveal answer
beginner
How do you check the status of a service named nginx using systemd?
Use the command systemctl status nginx to see if the service is running and its recent logs.
Click to reveal answer
beginner
What command enables a service to start automatically at boot with systemd?
Use systemctl enable <service-name> to make a service start automatically when the system boots.
Click to reveal answer
intermediate
What is the difference between systemctl start and systemctl enable?
systemctl start runs the service immediately. systemctl enable sets the service to start automatically at boot time.
Click to reveal answer
Which command shows the current running services managed by systemd?
Aservice --status-all
Bsystemctl list-units --type=service
Cinitctl list
Dchkconfig --list
✗ Incorrect
systemctl list-units --type=service lists all active services managed by systemd.
What file extension do systemd unit files usually have?
A.init
B.conf
C.service
D.sh
✗ Incorrect
Systemd service unit files typically end with .service.
How do you reload systemd manager configuration after editing a unit file?
Asystemctl daemon-reload
Bsystemctl restart
Csystemctl reload
Dsystemctl refresh
✗ Incorrect
systemctl daemon-reload reloads systemd configuration to apply changes.
Which command stops a running service immediately?
Asystemctl pause <service>
Bsystemctl disable <service>
Csystemctl kill <service>
Dsystemctl stop <service>
✗ Incorrect
systemctl stop stops the service immediately.
What does systemctl is-enabled <service> check?
AIf the service is set to start at boot
BIf the service is currently running
CIf the service is installed
DIf the service is masked
✗ Incorrect
systemctl is-enabled checks if the service is enabled to start automatically at boot.
Explain how systemd manages services during system startup and how you can control them.
Think about how your computer starts apps automatically and how you can turn them on or off.
You got /5 concepts.
Describe the steps to create a new systemd service and make it start automatically.
Imagine setting up a new app to run when your computer boots.
You got /5 concepts.
Practice
(1/5)
1. What is the main purpose of systemd in a Linux system?
easy
A. To manage how the system starts and stops programs automatically
B. To edit text files in the system
C. To compile software from source code
D. To monitor network traffic
Solution
Step 1: Understand systemd's role
systemd is a system and service manager that controls how programs start and stop on Linux.
Step 2: Compare options
Only To manage how the system starts and stops programs automatically describes managing startup and shutdown of programs, which matches systemd's purpose.
Final Answer:
To manage how the system starts and stops programs automatically -> Option A
Quick Check:
systemd manages startup and shutdown = B [OK]
Hint: Remember: systemd controls startup and shutdown of services [OK]
Common Mistakes:
Confusing systemd with text editors
Thinking systemd compiles code
Mixing systemd with network tools
2. Which of the following is the correct command to enable a service named nginx to start automatically at boot?
easy
A. systemctl enable nginx
B. systemctl start nginx
C. systemctl status nginx
D. systemctl stop nginx
Solution
Step 1: Understand systemctl commands
To enable a service to start at boot, the command is systemctl enable [service].
Step 2: Match command to action
systemctl enable nginx uses enable with nginx, which is correct for auto-start.
Final Answer:
systemctl enable nginx -> Option A
Quick Check:
Enable means auto-start = A [OK]
Hint: Enable means auto-start at boot, start means immediate run [OK]
Common Mistakes:
Using start instead of enable for auto-start
Confusing status with enable
Using stop instead of enable
3. What will be the output of the command systemctl is-active sshd if the SSH service is running?
medium
A. inactive
B. failed
C. active
D. unknown
Solution
Step 1: Understand systemctl is-active
This command checks if a service is running and returns its state.
Step 2: Identify expected output when running
If the SSH service is running, the output is active.
Final Answer:
active -> Option C
Quick Check:
Running service status = active [OK]
Hint: Active means running, inactive means stopped [OK]
Common Mistakes:
Confusing active with inactive
Expecting failed when service is running
Thinking unknown means running
4. You run systemctl enable apache2 but the service does not start on boot. What is the most likely reason?
medium
A. The service is already running
B. You used start instead of enable
C. The systemctl command is not installed
D. The service file for apache2 is missing or incorrect
Solution
Step 1: Understand what enable does
Enable creates links so the service starts at boot but does not start it immediately.
Step 2: Identify why enable might fail
If the service file is missing or broken, enabling won't work properly, so it won't start on boot.
Final Answer:
The service file for apache2 is missing or incorrect -> Option D
Quick Check:
Missing service file blocks enable = D [OK]
Hint: Enable needs a valid service file to work [OK]
Common Mistakes:
Confusing enable with start
Assuming systemctl is missing
Thinking running service means enable failed
5. You want to create a custom service that runs a script at startup. Which two steps must you perform to make sure it starts automatically with systemd?
hard
A. Add your script to /etc/rc.local and make it executable
B. Create a service file in /etc/systemd/system, then run 'systemctl enable yourservice' to auto-start it
C. Place your script in /usr/bin and reboot the system
D. Run 'systemctl start yourservice' and then 'systemctl status yourservice' only
Solution
Step 1: Create a systemd service file
Write a service file describing your script and place it in /etc/systemd/system/ to define how systemd runs it.
Step 2: Enable the service
Run systemctl enable yourservice to make it start automatically at boot.
Final Answer:
Create a service file in /etc/systemd/system, then run 'systemctl enable yourservice' to auto-start it -> Option B
Quick Check:
Create service file + enable = auto-start [OK]
Hint: Create service file and enable it to auto-start [OK]
Common Mistakes:
Only starting service without enabling
Using old /etc/rc.local method
Placing script without service file
Recommended
Ready to prove it?
Pass the test and this pattern moves unknownstrongwhile earning +1 Grip toward your certificate.