GO KALI FREE
Service Commands

systemctl restart Linux Command

Stops and then starts a systemd service.

What does systemctl restart do?

Stops and then starts a systemd service.

Syntax

systemctl restart service_name

Practical example

sudo systemctl restart ssh

Questions about systemctl restart

How do I restart a service with systemctl?

Use `sudo systemctl restart service_name` to stop and start a service. This is equivalent to running stop then start.

When should I use restart vs reload?

Use `restart` for a full restart (stop+start). Use `reload` to re-read config without downtime. Many services support reload for config changes.

How do I reload a service configuration?

Use `sudo systemctl reload service_name` to tell the service to re-read its configuration without stopping.

How do I restart multiple services?

Use `sudo systemctl restart service1 service2 service3` to restart multiple services in a single command.

What happens if restart fails?

systemd will report the failure. Use `systemctl status service_name` and `journalctl -u service_name` to diagnose the issue.

How do I see if a service needs restarting?

Use `needs-restarting -s` to see services that need restarting after updates, or `needs-restarting -r` to restart them automatically.

How do I restart a service and check status?

Use `sudo systemctl restart service_name && systemctl status service_name` to restart and immediately check the result.

How do I restart all failed services?

Use `sudo systemctl restart --failed` to restart all services that are currently in a failed state.

Related Service Commands

systemctl stop

Stops a running systemd service immediately.

systemctl enable

Enables a service to start automatically at boot time.

systemctl start

Starts a systemd service immediately.

systemctl disable

Disables a service from starting automatically at boot.

journalctl

Queries and displays logs from the systemd journal.

systemctl status

Shows the current status, recent logs, and PID of a systemd service.