← 返回命令列表

Linux command

systemctl-restart 命令

文件

复制后可按需替换文件名、目录或参数。

常用示例

Restart

systemctl restart [unit]

Example

systemctl restart [unit1] [unit2]

Example

systemctl restart [unit] --user

说明

systemctl restart stops and then starts systemd units. This is useful when a service needs to be fully restarted to pick up configuration changes or recover from an error state. Unlike systemctl reload, restart fully stops the service process and starts a new one. This causes a brief interruption but ensures a clean restart. Can be used on stopped units, but systemctl start is safer to avoid accidentally restarting running services.

参数

--user
Restart user service manager units instead of system units
--no-block
Do not wait for the operation to complete
--job-mode=_MODE_
Specify how to deal with already queued jobs

FAQ

What is the systemctl-restart command used for?

systemctl restart stops and then starts systemd units. This is useful when a service needs to be fully restarted to pick up configuration changes or recover from an error state. Unlike systemctl reload, restart fully stops the service process and starts a new one. This causes a brief interruption but ensures a clean restart. Can be used on stopped units, but systemctl start is safer to avoid accidentally restarting running services.

How do I run a basic systemctl-restart example?

Run `systemctl restart [unit]` in a terminal, then adjust file names, paths, flags, or remote targets for your system.

What does --user do in systemctl-restart?

Restart user service manager units instead of system units