systemctl

2024-12-22 linux

變更 systemctl 默認編輯器

sudo update-alternatives --config editor

執行結果

root@example:~# sudo update-alternatives --config editor
There are 3 choices for the alternative editor (providing /usr/bin/editor).

  Selection    Path                Priority   Status
------------------------------------------------------------
* 0            /bin/nano            40        auto mode
  1            /bin/nano            40        manual mode
  2            /usr/bin/vim.basic   30        manual mode
  3            /usr/bin/vim.tiny    15        manual mode

Press <enter> to keep the current choice[*], or type selection number: 2
update-alternatives: using /usr/bin/vim.basic to provide /usr/bin/editor (editor) in manual mode

同檔名優先權

/etc/systemd/system/lib/systemd/system 有相同服務檔案名,會優先使用 /etc/systemd/system 路徑中的內容。