Skip to Content

systemctl の共通コマンド

サービス管理

コマンド説明
sudo systemctl start service-nameサービスを開始する
sudo systemctl stop service-nameサービスを停止する
sudo systemctl restart service-nameサービスを再起動する
sudo systemctl reload service-name設定をリロードします (再起動せずに)
systemctl status service-nameサービスステータスを確認する

ブート起動

コマンド説明
sudo systemctl enable service-name起動時の自動起動を有効にする
sudo systemctl disable service-name起動時の自動起動を無効にする
sudo systemctl enable --now service-name自動開始を有効にしてすぐに開始する
systemctl is-enabled service-name自動起動が有効になっているかどうかを確認する
systemctl is-active service-name現在実行中かどうかを確認する

リストサービス

コマンド説明
systemctl list-units --type=service --state=running実行中のすべてのサービスをリストする
systemctl list-units --type=service --allすべてのサービスをリストします (非アクティブなものを含む)
systemctl list-unit-files --type=service --state=enabledすべてのブート対応サービスをリストする
systemctl list-units --failed失敗したサービスをリストする

ユーザーレベルのサービス

コマンド説明
systemctl --user start service-nameユーザーレベルのサービスを開始する
systemctl --user stop service-nameユーザーレベルのサービスを停止する
systemctl --user status service-nameユーザーレベルのサービスステータスを確認する
systemctl --user enable service-nameユーザーレベルのサービスの自動開始を有効にする
systemctl --user list-units --type=serviceユーザーレベルのサービスをリストする

共通のユーザーレベルのサービス: pipewire、pipewire-pulse、wireplumber

システム電源管理

コマンド説明
systemctl poweroff電源を切る
systemctl reboot再起動
systemctl suspend一時停止
systemctl hibernate休止状態
systemctl hybrid-sleepハイブリッドスリープ

サービス詳細を見る

コマンド説明
systemctl show service-name -p FragmentPathサービス構成ファイルのパスを表示する
systemctl cat service-name完全なサービス構成を表示する
systemctl show service-nameすべてのサービスプロパティを表示
systemctl list-dependencies service-nameサービスの依存関係ツリーを表示する

サービス構成の変更

コマンド説明
sudo systemctl edit service-nameオーバーライド構成を作成または編集する
sudo systemctl daemon-reload変更後に設定をリロードする
sudo systemctl restart service-nameサービスを再起動して変更を適用する

オーバーライド ファイルは /etc/systemd/system/service-name.service.d/override.conf にあります。 /lib/systemd/system/ 内のファイルを直接編集しないでください。

タイマー

コマンド説明
systemctl list-timers --allすべてのタイマーをリストする
systemctl status timer-name.timerタイマーのステータスを確認する
sudo systemctl enable --now timer-name.timerタイマーを有効にする
sudo systemctl disable timer-name.timerタイマーを無効にする

ログ関連

コマンド説明
journalctl -u service-nameサービスログを表示する
journalctl -u service-name -fサービスログをリアルタイムで追跡する
journalctl -u service-name -b現在の起動以降のサービス ログを表示する

ターゲット (実行レベル)

ターゲット説明
graphical.targetグラフィカル インターフェイス (デフォルト)
multi-user.targetマルチユーザーコマンドライン
rescue.targetレスキューモード
emergency.target緊急モード
コマンド説明
systemctl get-default現在のターゲットを確認する
sudo systemctl set-default multi-user.targetコマンドラインから起動する
sudo systemctl set-default graphical.targetグラフィカルインターフェイスを起動する
sudo systemctl isolate multi-user.targetターゲットを一時的に切り替える

役立つヒント

コマンド説明
sudo systemctl mask service-nameサービスをマスクする(開始を完全に阻止する)
sudo systemctl unmask service-nameサービスのマスクを解除する
systemd-analyze起動時間を確認する
systemd-analyze blame起動時間によるサービスのランク付け
systemd-analyze critical-chain重要なブート チェーンを表示する