systemctl とは、sytemd システムとサービス・マネージャーを制御するコマンドです。
systemd とは、Linuxシステムを起動し、サービスを管理するためのソフトウェア・スイートです。従来のinitシステムに代わるもので、より高速な起動や柔軟なサービス管理を可能にします。
$ ps -e
PID TTY TIME CMD
1 ? 00:00:01 systemd
(後略)
systemdは、Linuxカーネルが起動した後、最初に実行されるプロセス(PID 1)として動作します。主な役割は、システムを起動し、必要なサービスを管理することです。具体的には、以下の機能を提供します。
systemdは、多くのLinuxディストリビューションで標準的に採用されています。例えば、Red Hat Enterprise Linux、CentOS、Fedora、Ubuntuなどがsystemdを採用しています。
systemdは、systemctlコマンドを使って制御します。例えば、systemctl start service_name
でサービスを起動したり、systemctl status service_name
でサービスの現在の状態を確認したりできます。
systemctl [option]... command [unit]...
command
操作 | コマンド |
---|---|
サービスの起動 | systemctl start unit |
サービスの停止 | systemctl stop unit |
サービスの再起動 | systemctl restart unit |
サービスのリロード | systemctl reload unit |
サービスのステータス表示 | systemctl status unit |
サービス自動起動の有効化 | systemctl enable unit |
サービス自動起動の無効化 | systemctl disable unit |
サービス自動起動設定の確認 | systemctl is-enabled unit |
サービス一覧の表示 | systemctl list-unit-files --type=service |
設定ファイルの再読込 | systemctl daemon-reload |
サービス一覧を表示する。
$ systemctl list-unit-files --type=service
UNIT FILE STATE VENDOR PRESET
accounts-daemon.service enabled enabled
acpid.service disabled enabled
alsa-restore.service static -
alsa-state.service static -
alsa-utils.service masked enabled
anacron.service enabled enabled
apparmor.service enabled enabled
apt-daily-upgrade.service static -
apt-daily.service static -
autovt@.service alias -
avahi-daemon.service enabled enabled
blk-availability.service enabled enabled
blueman-mechanism.service enabled enabled
bluetooth.service enabled enabled
bolt.service static -
brltty-udev.service static -
brltty.service disabled enabled
casper-md5check.service enabled enabled
casper.service enabled enabled
colord.service static -
configure-printer@.service static -
console-getty.service disabled disabled