← 返回命令列表

Linux command

systemctl-unmask 命令

文本

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

常用示例

Unmask

systemctl unmask [service_name]

Unmask and start

systemctl unmask --now [service_name]

Unmask a user

systemctl --user unmask [service_name]

Unmask only until reboot

systemctl unmask --runtime [service_name]

Unmask several units

systemctl unmask [unit1] [unit2] [unit3]

说明

systemctl unmask removes the mask from one or more systemd units, making them startable again. Masking a unit links its unit file to `/dev/null`, which makes the unit completely unstartable (manually or as a dependency); unmasking removes that symlink and restores the original unit file. If the unit was previously masked at runtime (with `--runtime`), it can only be unmasked at runtime. Unmasking does not automatically start the unit — pair with `--now` to start immediately after unmasking.

参数

--now
Also start the unit(s) after unmasking.
--user
Operate on the calling user's units instead of system units.
--system
Operate on system units (default).
--global
Unmask for all users (enabled in `/etc/systemd/user/`).
--runtime
Apply changes only for the current boot; reset on reboot.
--no-block
Do not wait for the start job (with `--now`) to finish before returning.
-q, --quiet
Suppress informational messages.

FAQ

What is the systemctl-unmask command used for?

systemctl unmask removes the mask from one or more systemd units, making them startable again. Masking a unit links its unit file to `/dev/null`, which makes the unit completely unstartable (manually or as a dependency); unmasking removes that symlink and restores the original unit file. If the unit was previously masked at runtime (with `--runtime`), it can only be unmasked at runtime. Unmasking does not automatically start the unit — pair with `--now` to start immediately after unmasking.

How do I run a basic systemctl-unmask example?

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

What does --now do in systemctl-unmask?

Also start the unit(s) after unmasking.