linuxlab.io
Tutorials▾
  • Linux & networking
    File system, processes, TCP/IP, BGP and OSPF
    →
  • Terraform & IaC
    HCL, state, plan/apply on a LocalStack sandbox
    →
  • Git & GitHub
    Object model, plumbing, branching, GitHub Actions
    →
All tutorials →
PricingAboutSign inCreate account
/
  • Introduction
  • Lessons
  • How it works
  • Simulator
  • Knowledge base
  • Interview prep
Index
Categories
All entries
Footer
linuxlab-TutorialsPricingAboutPrivacy & cookies
Copyright © 2026 LinuxLab. All rights reserved.
home/linux/kb/Commands/cmd-systemctl

kb/commands ── Commands ── intermediate

systemctl: managing systemd services

`systemctl` is the main CLI for managing systemd units: services, timers, mounts, and sockets. It replaces SysV init and `service` on modern distros.

view as markdownaka: systemd-cli

Basic commands

bash
systemctl status nginx              # current unit state + recent log lines
sudo systemctl start nginx          # start
sudo systemctl stop nginx           # stop (graceful: SIGTERM -> SIGKILL after TimeoutStopSec)
sudo systemctl restart nginx        # = stop + start
sudo systemctl reload nginx         # send [[signals]] SIGHUP - reload config without restarting
sudo systemctl enable nginx         # start at boot
sudo systemctl disable nginx        # do not start at boot
sudo systemctl enable --now nginx   # enable + start in one command

Viewing units

bash
systemctl                                  # all loaded and active units
systemctl list-units --type=service        # services only
systemctl list-units --state=failed        # failed units
systemctl list-unit-files                  # all known units (including disabled)
systemctl is-active nginx                  # active / inactive / failed (for scripts)
systemctl is-enabled nginx                 # enabled / disabled

cgroup tree

bash
systemctl status nginx       # bottom section: Tasks, Memory, CPU, and cgroup path
systemd-cgtop                # top-style view by [[cgroups]]
systemd-cgls                 # cgroup tree

Where unit files live

  • /etc/systemd/system/ - your local files and drop-ins (highest priority)
  • /lib/systemd/system/ or /usr/lib/systemd/system/ - files from packages

After editing:

bash
sudo systemctl daemon-reload          # re-read unit files
sudo systemctl restart <unit>         # apply changes

Overriding without editing the original

bash
sudo systemctl edit nginx
# -> opens an editor for the drop-in: /etc/systemd/system/nginx.service.d/override.conf
# -> you can override individual settings in the [Service] section

This is the right approach. The original package unit stays untouched.

Other subcommands

bash
systemctl list-timers              # active timers (cron replacement)
systemctl reboot / poweroff        # reboot / shut down
systemctl --user start foo         # user-level systemd (per-user)
systemctl mask <unit>              # prevent a unit from starting at all (even as a dependency)

Using journalctl together

Logs go to a separate binary, cmd-journalctl:

bash
journalctl -u nginx -f             # tail logs for a specific unit
journalctl -u nginx --since today

§ команды

bash
systemctl status nginx

Unit summary card: state + last 10 log lines

bash
sudo systemctl enable --now nginx

Start and enable at boot in one command

bash
systemctl list-units --state=failed

All failed services. A common first step when diagnosing problems.

bash
sudo systemctl edit myapp

Open a drop-in override without touching the original unit file

bash
systemctl is-active nginx && echo OK

Scriptable status check (exit code 0/1)

§ см. также

  • systemdsystemd: the init system and service managersystemd is the Linux init system: PID 1 that starts everything else, tracks dependencies, restarts what crashes, and collects the logs.
  • cmd-journalctljournalctl: systemd journal`journalctl` reads the binary journal written by systemd-journald. It is the central log for the system: kernel, systemd services, syslog, all through one interface.
  • cmd-cron-crontabcron and crontab: scheduling taskscron is a daemon that reads crontab files and runs jobs on a schedule. Format: `min hour day month weekday command`. anacron handles machines that are powered off. On systemd systems, timers are often used instead.
  • cmd-psps: process snapshotps prints a snapshot of processes at the moment it runs. Two dialects: BSD (`aux`, no dash) and UNIX (`-ef`, with dash). `-o` specifies columns. For continuous monitoring, use [[cmd-htop|htop]].
  • cmd-htophtop: interactive process monitorhtop is an interactive TUI process monitor. F-keys: F3 search, F4 filter, F5 tree, F6 sort, F9 kill. Color meters at the top, process list below. It replaces top wherever it is available.
Footer
linuxlab-
Copyright © 2026 LinuxLab. All rights reserved.
Tutorials
Pricing
About
Privacy & cookies