Ubuntu 25.04
Sponsored Link

初期設定 : サービスの管理2025/04/18

 

サービスの状態の確認や 有効化/無効化 は以下のように実行可能です。

[1] サービスの一覧を表示します。
# 現在起動しているサービスの一覧を表示
# [--all] 付加で 停止中も含めて全サービスをリスト
# [--no-pager] 付加で [less/more] 等の pager に渡さない

root@localhost:~#
systemctl -t service

  UNIT                             LOAD   ACTIVE SUB     DESCRIPTION  
  apparmor.service                 loaded active exited  Load AppArmor
  apport.service                   loaded active exited  automatic cra
  blk-availability.service         loaded active exited  Availability 
  console-setup.service            loaded active exited  Set console f
  cron.service                     loaded active running Regular backg
  dbus.service                     loaded active running D-Bus System 
  finalrd.service                  loaded active exited  Create final 
  getty@tty1.service               loaded active running Getty on tty1
  kdump-tools.service              loaded active exited  Kernel crash 
  keyboard-setup.service           loaded active exited  Set the conso

.....
.....

Legend: LOAD   → Reflects whether the unit definition was properly loaded.
        ACTIVE → The high-level unit activation state, i.e. generalization of SUB.
        SUB    → The low-level unit activation state, values depend on unit type.

50 loaded units listed. Pass --all to see loaded but inactive units, too.
To show all installed unit files use 'systemctl list-unit-files'.

# サービスの起動設定の一覧を表示

root@localhost:~#
systemctl list-unit-files -t service

UNIT FILE                                    STATE           PRESET
apparmor.service                             enabled         enabled
apport-autoreport.service                    static          -
apport-coredump-hook@.service                static          -
apport-forward@.service                      static          -
apport.service                               enabled         enabled
apt-daily-upgrade.service                    static          -
apt-daily.service                            static          -
apt-news.service                             static          -
autovt@.service                              alias           -
blk-availability.service                     enabled         enabled

.....
.....

xfs_scrub_fail@.service                      static          -
xfs_scrub_media@.service                     static          -
xfs_scrub_media_fail@.service                static          -

251 unit files listed.
[2] もし自身の環境で不要なサービスがあれば、以下のようにして停止と自動起動の無効化設定をします。
以下の例では Apparmor 停止/無効に設定しています。なお、サービス名末尾の [.service] は省略可能です。
root@localhost:~#
systemctl stop apparmor

root@localhost:~#
systemctl disable apparmor

関連コンテンツ