CloudsArk
Commands Linux

What Is the systemctl Command in Linux?

Learn what the systemctl command does in Linux, how its syntax works, and when to use it.

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 start with enable; one affects now, the other affects boot.
  • Restarting remote access services without checking their configuration.
  • Ignoring journalctl -u when a service fails.

Quick Reference

systemctl status sshd
sudo systemctl restart sshd
systemctl is-active sshd

Summary

The systemctl command is safest when you understand the target, choose the right option, and verify the result with a separate command.