Linux Terminal Command: systemctl

The systemctl command is an essential tool in System Services & Scheduling. In this tutorial, we will explore what systemctl does, look at everyday examples, and cover advanced options to supercharge your command-line workflow.


Concept & Explanation

The systemctl command manages system services, checking status, enabling boot logs, and restarting daemons under systemd.


Common Options & Syntax

systemctl [options] [arguments]

Here are the most common flags used with systemctl:


1. Interactive Example (Simple)

Here is how most people run the command:

# Example
systemctl status nginx

What it does: Displays the active status and recent log lines of the Nginx service.


2. Power-User Example (Advanced)

For scripting and advanced diagnostics, use this configuration:

# Advanced
sudo systemctl enable nginx && sudo systemctl restart nginx

What it does: Configures Nginx to start automatically on system boot and restarts the active service instance.


⚙️ Warning & Common Pitfalls

[!WARNING] Do not confuse service and systemctl. While service works on SysVinit systems, systemctl is the standard control tool on systemd platforms.


Here are some related posts on cli_tty1 you might want to check out: