← 返回命令列表

Linux command

systemctl-enable 命令

文本

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

常用示例

Enable

systemctl enable [unit]

Example

systemctl enable [unit] --now

Example

systemctl enable [unit] --user

说明

systemctl enable creates symbolic links in systemd directories to enable units to start automatically at boot (for system units) or at login (for user units). This does not start the unit immediately; use --now to both enable and start. The symlinks are created based on the Install section of the unit file, typically linking into target.wants directories. Enabling is idempotent; enabling an already-enabled unit has no effect.

参数

--now
Also start the unit after enabling
--user
Enable user service manager units instead of system units
--no-reload
Do not reload systemd configuration after enabling
--force
Enable units even if they are masked
--runtime
Enable temporarily until next reboot only

FAQ

What is the systemctl-enable command used for?

systemctl enable creates symbolic links in systemd directories to enable units to start automatically at boot (for system units) or at login (for user units). This does not start the unit immediately; use --now to both enable and start. The symlinks are created based on the Install section of the unit file, typically linking into target.wants directories. Enabling is idempotent; enabling an already-enabled unit has no effect.

How do I run a basic systemctl-enable example?

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

What does --now do in systemctl-enable?

Also start the unit after enabling