0Pricing
Linux Command Line Mastery · レッスン

サービス管理:`systemctl`(systemd)

`systemctl`コマンドを使って、システムサービスやデーモンを制御・管理します。

「サービス管理:`systemctl`(systemd)」はCoddyKit上の無料Linux Command Line Masteryレッスンです。 これはレッスン2/4です。 下記で完全なレッスンを無料で読むことができます。その後、ブラウザ内の組み込みコードエディタと24時間対応のAIチューターでハンズオン演習できます。 これはLinux Command Line Mastery学習パスの一部であり、ウェブとCoddyKitアプリ全体で進捗が同期されます。 Linux Command Line Masteryコースには全4レッスンが含まれています。

このレッスンの一部はまだ翻訳されておらず、英語で表示されています。

What are System Services?

On Linux, many programs run silently in the background to perform essential tasks. These are called services or daemons.

Think of them as silent helpers: a web server, a database, or even your Wi-Fi manager. They often start automatically when your system boots.

Meet systemd

systemd is the initialization system used by most modern Linux distributions (like Ubuntu, Fedora, CentOS).

It's responsible for managing services and processes from boot-up to shut-down, ensuring everything starts and stops in the correct order.

Your Tool: systemctl

To interact with systemd and manage these services, we use the powerful systemctl command.

It's your primary interface for checking status, starting, stopping, enabling, and disabling services on your system.

Check Service Status

The first step is often checking if a service is running. Use systemctl status <service_name>.

Let's check the status of the SSH daemon (sshd), which allows secure remote access to your machine.

systemctl status sshd

Starting a Service

If a service isn't running or you've stopped it, you can start it with systemctl start <service_name>.

This command attempts to begin the service immediately. You'll often need root privileges (using sudo) for most system services.

sudo systemctl start sshd

Stopping a Service

To halt a running service, use systemctl stop <service_name>.

This is useful if you need to perform maintenance or reconfigure a service. Be cautious, as stopping critical services can affect system functionality.

sudo systemctl stop sshd

Restart vs. Reload

Restarting (systemctl restart <service>) fully stops and then starts a service. This is often needed after major configuration changes.

Reloading (systemctl reload <service>) tells a service to re-read its configuration without a full restart, minimizing downtime. Not all services support reload.

sudo systemctl restart sshd

Managing Autostart

Services can be set to start automatically at boot. This is called enabling the service.

  • sudo systemctl enable <service>: Configures a service to start on boot.
  • sudo systemctl disable <service>: Prevents a service from starting on boot.

These commands only modify boot behavior; they don't start/stop the service immediately.

sudo systemctl enable sshd

Listing All Services

To see a list of all loaded services and their current status (active, inactive, enabled, disabled), use systemctl list-units --type=service --all.

This command provides a comprehensive overview of what's configured on your system.

systemctl list-units --type=service --all

Quick Check: Service Control

Which command would you use to prevent the apache2 web server service from starting automatically when your Linux system boots up?

Recap: Service Management

You've learned how to manage system services using the powerful systemctl command!

  • Use status to check a service's state.
  • start, stop, restart to control running services.
  • enable and disable to manage boot-time behavior.
  • list-units --type=service --all to view all services.

Mastering systemctl is crucial for effective Linux system administration.

よくある質問

「サービス管理:`systemctl`(systemd)」レッスンは無料ですか?

はい。「サービス管理:`systemctl`(systemd)」の完全なテキストはこのウェブで無料で読めます。インタラクティブに演習し(組み込みコードエディタと24時間対応のAIチューター)、Linux Command Line Masteryコースの残りをアンロックするには、CoddyKit PROにアップグレードしてください。 Linux Command Line Masteryコースには全4レッスンが含まれています。

「サービス管理:`systemctl`(systemd)」で何を学びますか?

`systemctl`コマンドを使って、システムサービスやデーモンを制御・管理します。 ブラウザで直接実行するハンズオンコードでLinux Command Line Masteryを演習し、24時間対応のAIチューターがレッスンを進める中での質問に答えます。

Linux Command Line Masteryを始めるのに経験は必要ですか?

事前経験は必要ありません。CoddyKitのLinux Command Line Masteryは初級者から上級者向けに構成されているため、ここから始めるか最初から始めて、自分のペースで進むことができます。 これはレッスン2/4です。

「サービス管理:`systemctl`(systemd)」レッスンにはどのくらい時間がかかりますか?

ほとんどのCoddyKitレッスンは約5~10分かかります。各レッスンはコンパクトでインタラクティブなので、着実に進歩し、ウェブとアプリ全体で正確に前回の場所から再開できます。

このLinux Command Line Masteryレッスンでコードを書いて実行できますか?

はい。すべてのLinux Command Line Masteryレッスンに組み込みコードエディタが含まれているため、ブラウザでリアルコードを書いて実行し、即座のAIフィードバックを取得できます。ローカル設定は不要です。

このコースのすべてのレッスン

  1. ジョブのスケジューリング:`cron`と`at`
  2. サービス管理:`systemctl`(systemd)
  3. シェル関数によるタスクの自動化
  4. journald と logrotate による集中ロギングとローテーション
← Linux Command Line Masteryに戻る