Modern Oracle Linux systems use systemd as their default system and service manager. The systemctl command is your main tool to control services - starting, stopping, enabling, and checking their status.
In this blog, you’ll learn how to use systemctl effectively to manage services and system states.
Step 1: Understanding systemd and systemctl
systemd is the system and service manager that replaced older init systems. It’s responsible for:
-
Starting services during boot
-
Managing service dependencies
-
Handling background daemons and timers
-
Logging events
systemctl is the command-line utility for interacting with systemd.
Step 2: Checking Service Status
To check whether a service is running:
systemctl status servicename
Example:
sudo systemctl status sshd

Output:
● sshd.service - OpenSSH server daemon
Loaded: loaded (/usr/lib/systemd/system/sshd.service; enabled)
Active: active (running)
Key fields:
-
Loaded: service file exists and is recognized
-
Active: shows whether it’s running
-
Enabled: means it starts automatically on boot
Step 3: Starting and Stopping Services
Start a service:
sudo systemctl start servicename
Stop a service:
sudo systemctl stop servicename
Restart a service:
sudo systemctl restart servicename
Reload service configuration (without stopping it):
sudo systemctl reload servicename
Example:

Step 4: Enabling and Disabling Services at Boot
To start a service automatically at boot:
sudo systemctl enable servicename
To disable auto-start:
sudo systemctl disable servicename
To check if a service is enabled:
systemctl is-enabled servicename
Example:

Step 5: Viewing All Services
List all running services:
systemctl list-units --type=service --state=running

List all (active/inactive):
systemctl list-units --type=service

List all installed services (even inactive):
systemctl list-unit-files --type=service

Step 6: Analyzing Service Logs
You can view logs for a specific service using journalctl:
sudo journalctl -u servicename
Example:

To see only recent entries:
sudo journalctl -u sshd -n 20

To continuously monitor logs (like tail -f):
sudo journalctl -u sshd -fStep 7: Reloading the systemd Daemon
If you edit a service file manually, reload systemd to apply changes:
sudo systemctl daemon-reload
Then restart the service:
sudo systemctl restart servicenameStep 8: Masking and Unmasking Services
Masking prevents a service from being started manually or automatically.
To mask a service:
sudo systemctl mask servicename
To unmask:
sudo systemctl unmask servicename
Example:
sudo systemctl mask httpd

Step 9: Check System Boot Performance
You can analyze boot time and identify slow services using:
systemd-analyze
To see detailed breakdowns:
systemd-analyze blame
Step 10: Rebooting and Power Management
systemctl can also control the system state.
|
Task |
Command |
|
Reboot the system |
sudo systemctl reboot |
|
Power off the system |
sudo systemctl poweroff |
|
Suspend |
sudo systemctl suspend |
|
Halt |
sudo systemctl halt |
Conclusion
You now know how to manage services on Oracle Linux using systemctl. This skill helps you control system processes, troubleshoot issues, and ensure your server behaves exactly as you expect.
In the next post, we’ll learn how to monitor system performance and resources, a crucial part of maintaining a healthy Oracle Linux environment.
