systemctl-restart
Restart a systemd service
TLDR
Restart a unit
Restart more than one unit
Restart a user unit
SYNOPSIS
systemctl restart [OPTIONS...] [UNIT...]
PARAMETERS
--user
Operate on user units instead of system-wide
--system
Operate on system units (default)
--no-block
Do not wait for units to finish starting up
--remain-after-exit
Wait for start-up and termination jobs to finish
--no-ask-password
Do not prompt for password even if needed
--failed
Restart only failed units (when no UNIT specified)
--runtime
Restart only runtime units, ignore persistent
--signal=NAME
Signal to send on stop (default TERM)
--kill-who=WHO
Kill process (main, all, control)
-H, --host=HOST
Operate on remote host via SSH
DESCRIPTION
systemctl restart is a command-line utility within the systemd suite used to restart one or more loaded units, such as services, sockets, timers, or targets. It performs a stop followed by a start on the specified unit(s), effectively resetting their state and reloading configurations if applicable. For Type=simple or Type=forking services, this causes a brief downtime during the transition.
By default, it operates on system-wide units managed by the root user. The --user option targets user-specific sessions. Wildcards (e.g., ssh*.service) and globs allow restarting multiple matching units. The command waits for the operation to complete unless --no-block is used, providing feedback via job IDs.
Restart is ideal for applying config changes without disabling/enabling units. It respects unit dependencies, queuing jobs appropriately. Failures occur if units are masked, inactive, or lack restart support. Logs are available via journalctl for troubleshooting.
This replaces legacy service restart in SysV init systems, offering better integration with systemd's dependency management and parallelization.
CAVEATS
Causes downtime for most services; test in non-production first. Units like sockets or mounts may not support restart. Masked units fail silently. Use sudo for system units.
EXAMPLES
systemctl restart sshd.service
Restarts SSH service.
systemctl --user restart firefox.service
Restarts user Firefox.
systemctl restart 'nginx*'
Restarts all nginx-related units.
EXIT CODES
0: success.
1: generic failure.
2: invalid args.
3: unit not found.
4: masked unit.
5: deps failed.
HISTORY
Introduced with systemd v26 in 2010 as part of migrating from SysV init and Upstart. Evolved with systemd releases, adding options like --remain-after-exit in v197 (2013) and parallel job execution improvements.


