Command referencesystemctl
systemctl command (Linux / bash / sh / zsh)
What it does
Control and inspect services and other systemd units. When people search for the systemctl command linux services, they usually want systemctl's everyday flags, safe examples, and how it differs from related tools. Below you'll find syntax, options, and copyable examples for Bash/sh/zsh.
Control and inspect services and other systemd units.
Syntax
systemctl [OPTION]... COMMAND [UNIT...]
Common options
| Flag / option | Meaning |
|---|---|
| status UNIT | Show current unit state and recent logs. |
| start UNIT | Start a unit now. |
| enable UNIT | Configure a unit to start at boot. |
| restart UNIT | Stop and start a unit. |
| --user | Operate on the calling user's service manager. |
Practical examples
Inspect service
systemctl status nginx.service
Shows nginx state and diagnostics.
Enable and start
sudo systemctl enable --now nginx
Starts nginx and enables boot startup.
Reload units
sudo systemctl daemon-reload
Reloads unit definitions after edits.
Linux ↔ Windows equivalent
Closest match: Get-Service (Windows / PowerShell). Retrieve service controller objects and current service states.
Common mistakes
- Assuming `enable` also starts a service unless `--now` is supplied.
- Forgetting daemon-reload after changing a unit file.
Related commands
- journalctlQuery and follow logs stored by the systemd journal.
- psDisplay a snapshot of running processes.
- Get-ServiceRetrieve service controller objects and current service states.
- exportMark shell variables for inheritance by child processes.
- setDisplay, create, or remove CMD environment variables.
- shutdownShut down, restart, sign out, or schedule power actions.
- dateDisplay or format the system date and time.
- systeminfoDisplay detailed operating system, hardware, boot, memory, and update information.
FAQ
What does systemctl do in Linux?
Control and inspect services and other systemd units.
How do I use systemctl from the terminal?
Start with `systemctl [OPTION]... COMMAND [UNIT...]`, then choose only the options needed for the task.
What is a practical systemctl example?
Try `systemctl status nginx.service` — Shows nginx state and diagnostics.
Can I use systemctl in a shell script?
Yes. systemctl works in Bash, sh, and Zsh, but scripts should handle quoting, errors, and command output explicitly.
Browse the full Linux and Windows command reference to search more bash, CMD, PowerShell, Conda, and GitHub CLI commands.