# 🥸Become a systemd Monitoring Ninja!🥷

### **1️⃣ Check All Active and Inactive Services**

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

🔹 This shows **all services**, whether active, inactive, or failed.

---

### **2️⃣ Check All Active Timers**

```plaintext
systemctl list-timers --all
```

🔹 This displays all **systemd timers**, including **when they last ran** and **when they will run next**.

---

### **3️⃣ Show the Status of a Specific Service**

```plaintext
systemctl status <service-name>
```

🔹 Example: Check the status of **cron**:

```plaintext
systemctl status cron.service
```

---

### **4️⃣ Show the Status of a Specific Timer**

```plaintext
systemctl status <timer-name>.timer
```

🔹 Example: Check a **custom-reboot timer**:

```plaintext
systemctl status custom-reboot.timer
```

---

### **5️⃣ Check Failed Units Only**

```plaintext
systemctl --failed
```

🔹 This **only** shows failed services, helping with troubleshooting.

---

### **6️⃣ Get a Summary of All Services (Including Failed Ones)**

```plaintext
systemctl list-units --type=service --state=failed
```

🔹 Shows **only failed services**.

---

### **7️⃣ Check If a Specific Service is Enabled at Boot**

```plaintext
systemctl is-enabled <service-name>
```

🔹 Example: Check if `ssh` starts on boot:

```plaintext
systemctl is-enabled ssh
```

* **Output:**
    
    * `enabled` ✅ → Runs on boot
        
    * `disabled` ❌ → Does not run on boot
        
    * `static` 🔄 → Dependency of another service
        

---

### **8️⃣ Get a One-Liner Summary of All Systemd Services**

```plaintext
systemctl list-units --type=service --no-pager
```

🔹 This gives a **concise** list of all services.

---

### **Bonus: Interactive TUI (ncurses) Tools**

If you prefer a **ncurses-based** interface:

1️⃣ `systemd-cgtop` → Shows systemd resource usage (CPU, Memory, etc.)

```plaintext
systemd-cgtop
```

2️⃣ `systemd-analyze blame` → Shows slow-starting services

```plaintext
systemd-analyze blame
```

3️⃣ `systemd-analyze critical-chain` → Shows slow dependencies in the boot sequence

```plaintext
systemd-analyze critical-chain
```

---

### **Summary Table 📊**

| Command | Description |
| --- | --- |
| `systemctl list-units --type=service --all` | Show all services (active & inactive) |
| `systemctl list-timers --all` | List all timers |
| `systemctl status <unit>` | Show status of a unit |
| `systemctl --failed` | Show only failed services |
| `systemctl is-enabled <unit>` | Check if a service runs at boot |
| `systemd-analyze blame` | Show slow-starting services |
| `systemd-analyze critical-chain` | Show dependency delays in boot |
| `systemd-cgtop` | Show systemd CPU/memory usage |

---

🚀 **Now you're a systemd monitoring ninja!** 😎
