この記事では、LPIC 学習向けに systemctl コマンドを整理します。systemctl は systemd の unit を操作する中心的なコマンドで、サービスの起動、停止、有効化、状態確認に使います。
systemctl の基本操作
| 操作 | コマンド |
| 状態確認 | systemctl status nginx |
| 起動 | systemctl start nginx |
| 停止 | systemctl stop nginx |
| 再起動 | systemctl restart nginx |
| 自動起動有効化 | systemctl enable nginx |
| 自動起動無効化 | systemctl disable nginx |
サービスを操作する
systemctl status sshd
systemctl start sshd
systemctl restart sshd
systemctl enable sshd
systemctl is-enabled sshdunit 一覧を確認する
systemctl list-units
systemctl list-unit-files
systemctl --failedtarget を確認する
systemd では、従来のランレベルに相当するものとして target を使います。
systemctl get-default
systemctl set-default multi-user.target
systemctl isolate rescue.target注意点
startは今すぐ起動、enableは次回起動時の自動起動設定です。- 設定ファイルを変更した後は
daemon-reloadが必要な場合があります。 - 失敗した unit は
systemctl --failedとjournalctlで確認します。
まとめ
systemctl は、systemd 環境でサービスと unit を管理する基本コマンドです。LPIC では、start と enable の違い、unit 一覧、failed unit、target の扱いを押さえると実用的です。
関連する記事
- LPIC 学習ノート – Linux 基礎とコマンド整理
LPIC 関連記事のハブです。 - LPIC systemd – Linux の起動とサービス管理
現代 Linux の init システムです。 - LPIC journalctl コマンド – systemd journal を確認する
起動後のログ確認に使います。
参考書籍
参考
書籍
書籍
参考書籍
ストーリーで覚える Linux CLI 入門
Linux のコマンドライン操作を基礎から確認したい場合の参考書籍です。価格や在庫はリンク先で確認してください。
Amazon で見るこのリンクは Amazon アソシエイトリンクです。
LPIC systemctl コマンド – systemd unit を操作する

