← 返回命令列表

Linux command

systemctl-edit 命令

安全

权限或系统影响较大,执行前请核对目标。

常用示例

Overlay

sudo systemctl edit [unit]

Edit

sudo systemctl edit [unit] --full

Create

sudo systemctl edit [unit] --full --force

Example

systemctl edit [unit] --user

说明

systemctl edit opens a text editor to modify systemd unit files. By default, it creates a drop-in override file in `/etc/systemd/system/<unit>.d/override.conf` that extends the original unit without modifying it directly. With `--full`, the entire unit file is opened for editing. With `--full --force`, a new unit file can be created. After editing, systemd automatically reloads the configuration. The editor is determined by `SYSTEMD_EDITOR`, `EDITOR`, or `VISUAL` environment variables.

参数

-l, --full
Edit the main unit file instead of creating a drop-in override
--force
Create a new unit file if it doesn't exist (with --full)
--user
Edit user unit files
--system
Edit system unit files (default)
--runtime
Make changes temporary (cleared on reboot)

FAQ

What is the systemctl-edit command used for?

systemctl edit opens a text editor to modify systemd unit files. By default, it creates a drop-in override file in `/etc/systemd/system/<unit>.d/override.conf` that extends the original unit without modifying it directly. With `--full`, the entire unit file is opened for editing. With `--full --force`, a new unit file can be created. After editing, systemd automatically reloads the configuration. The editor is determined by `SYSTEMD_EDITOR`, `EDITOR`, or `VISUAL` environment variables.

How do I run a basic systemctl-edit example?

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

What does -l, --full do in systemctl-edit?

Edit the main unit file instead of creating a drop-in override