systemctl – control the systemd system and service manager

-
-

systemctl controls systemd services. Use it to start, stop, enable, and check the status of services on modern Linux systems.

Synopsis

systemctl [OPTIONS] COMMAND [UNIT...]

Common Commands

CommandDescription
startStart a service
stopStop a service
restartRestart a service
reloadReload config without restart
statusShow service status
enableStart at boot
disableDon’t start at boot
is-activeCheck if running
is-enabledCheck if enabled at boot

Examples

Service management

$ sudo systemctl start nginx
$ sudo systemctl stop nginx
$ sudo systemctl restart nginx
$ sudo systemctl reload nginx    # Reload config

Check status

$ systemctl status nginx
● nginx.service - A high performance web server
   Loaded: loaded (/lib/systemd/system/nginx.service; enabled)
   Active: active (running) since Mon 2025-01-15 10:00:00 UTC
     Docs: man:nginx(8)
 Main PID: 1234 (nginx)

Enable/disable at boot

$ sudo systemctl enable nginx
$ sudo systemctl disable nginx
$ systemctl is-enabled nginx
enabled

Quick checks

$ systemctl is-active nginx
active
$ systemctl is-failed nginx
active

List services

# All loaded units
$ systemctl list-units

# Only services
$ systemctl list-units --type=service

# All installed services
$ systemctl list-unit-files --type=service

# Failed services
$ systemctl --failed

View service file

$ systemctl cat nginx
$ systemctl show nginx    # All properties

Edit service

$ sudo systemctl edit nginx    # Create override
$ sudo systemctl edit --full nginx    # Edit entire file

System Commands

# Reboot
$ sudo systemctl reboot

# Shutdown
$ sudo systemctl poweroff

# Suspend
$ sudo systemctl suspend

# View boot targets
$ systemctl get-default
graphical.target

# Change to multi-user (no GUI)
$ sudo systemctl isolate multi-user.target

Common Patterns

Restart if running

$ sudo systemctl try-restart nginx

Reload or restart

$ sudo systemctl reload-or-restart nginx

Mask service (prevent starting)

$ sudo systemctl mask nginx
$ sudo systemctl unmask nginx

Reset failed status

$ sudo systemctl reset-failed

Tips

  • Check logs: Use journalctl -u service for service logs
  • Tab completion: Type systemctl sta<TAB> for commands
  • No sudo for status: systemctl status works as regular user
  • User services: systemctl --user for user-level services

See Also

Tutorials