New advertisers: 50% off your first month with code FIRSTMONTHSee slots

Systemd service management guide covering unit files, service types, sandboxing, journal logs, and timers.

skills.sh installs
262
GitHub stars
60
last updated
Aug 21, 2026
View on GitHub

What it does

  • Covers service lifecycle control with systemctl commands, dependency inspection, and unit-file search order across /etc, /run, and /usr/lib
  • Includes unit templates for simple, forking, oneshot, and notify service types, plus resource limits, environment files, and sandboxing options
  • Provides journalctl recipes for filtering by unit, time, and priority, along with journal size and retention cleanup
  • Designed for Linux administrators deploying Node.js or Java applications and scheduling recurring jobs with timer units

Install

$ npx -y skills add chaterm/terminal-skills --skill systemd -y

Installs into .agents/skills for every agent it finds here, and .claude/skills for Claude Code.

Files

Systemd 服务管理

概述

Systemd 服务单元编写、依赖管理、日志查看等技能。

服务管理

基础命令

# 启停服务
systemctl start service-name
systemctl stop service-name
systemctl restart service-name
systemctl reload service-name       # 重载配置(不中断服务)

# 开机启动
systemctl enable service-name
systemctl disable service-name
systemctl enable --now service-name # 启用并立即启动

# 查看状态
systemctl status service-name
systemctl is-active service-name
systemctl is-enabled service-name
systemctl is-failed service-name

服务列表

# 列出所有服务
systemctl list-units --type=service
systemctl list-units --type=service --state=running
systemctl list-units --type=service --state=failed

# 列出所有单元文件
systemctl list-unit-files --type=service

# 查看依赖
systemctl list-dependencies service-name
systemctl list-dependencies --reverse service-name

单元文件

文件位置

# 系统单元(包管理器安装)
/usr/lib/systemd/system/

# 管理员自定义
/etc/systemd/system/

# 运行时生成
/run/systemd/system/

# 优先级:/etc > /run > /usr/lib

基础服务单元

# /etc/systemd/system/myapp.service
[Unit]
Description=My Application
Documentation=https://example.com/docs
After=network.target
Wants=network-online.target

Details

Repository
github.com/chaterm/terminal-skills
Category
DevOps & Cloud
First seen
Jun 3, 2026

More from chaterm/terminal-skills

All 5

Similar to Systemd

More DevOps & Cloud