CloudsArk
Commands Linux

systemctl Command Examples in Linux

Practice useful systemctl command examples for everyday Linux administration and troubleshooting.

systemctl Command Examples in Linux

Introduction

These examples show practical ways to use systemctl on a Linux terminal. Each example is written so you can adapt it for administration or troubleshooting.

Example 1: Basic Usage

systemctl status sshd

This is the simplest form of the command and is a good starting point before adding options.

Example 2: Common Admin Task

sudo systemctl restart sshd

This example reflects a common task on RHEL, Rocky Linux, AlmaLinux, or similar systems.

Example 3: Useful Option

sudo systemctl enable --now httpd

This option helps narrow the result, change behavior, or handle a more realistic target.

Example 4: Real-World Scenario

systemctl --failed

Use this pattern when the task moves beyond a single basic command.

Example 5: Verification

systemctl is-active sshd

Example output:

active

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
sudo systemctl enable --now httpd
systemctl --failed
systemctl is-active sshd

Summary

Good systemctl usage means choosing the right option, keeping the target clear, and verifying the result with output you can explain.