What Is the systemctl Command in Linux?¶
Introduction¶
The systemctl command controls systemd services, targets, and units. It is useful for beginners, Linux administrators, DevOps engineers, and RHCSA students because it solves practical terminal tasks.
What the Command Does¶
Use systemctl to work with the specific Linux object it manages. Before changing anything, identify the target and run a read-only check when possible.
Basic Syntax¶
systemctl COMMAND UNIT
The syntax includes the command, any options, and the target object.
Common Options¶
status: show unit status.enable: start a unit at boot.--failed: list failed units.
Practical Examples¶
systemctl status sshd
sudo systemctl restart sshd
sudo systemctl enable --now httpd
systemctl --failed
Verification command:
systemctl is-active sshd
Example output:
active
When to Use This Command¶
Use systemctl to start, stop, restart, enable, disable, and inspect services on systemd-based distributions such as RHEL, Rocky Linux, AlmaLinux, and modern Ubuntu.
Common Mistakes¶
- Confusing
startwithenable; one affects now, the other affects boot. - Restarting remote access services without checking their configuration.
- Ignoring
journalctl -uwhen a service fails.
Quick Reference¶
systemctl status sshd
sudo systemctl restart sshd
systemctl is-active sshd
Related Guides¶
- systemctl examples
- systemctl enable vs start explained
- systemctl Troubleshooting Services
- systemctl interview questions
Summary¶
The systemctl command is safest when you understand the target, choose the right option, and verify the result with a separate command.