This is a comprehensive reference for managing systemd services on Linux. It covers the basics like starting, stopping, and enabling services, then digs into writing service unit files with examples for Node.js and Java apps. You'll find practical sections on resource limits, security hardening options like ProtectSystem and PrivateNetwork, and using journalctl to actually read logs in a useful way. The timer units section is solid if you're replacing cron jobs. What makes this useful is the concrete configuration examples and the troubleshooting table at the end. It assumes you already know why you need systemd and jumps straight to the how.

skills.sh installs
259
GitHub stars
59
last updated
Aug 21, 2026

Install

$ npx -y skills add chaterm/terminal-skills --skill systemd --agent claude-code

Installs into .claude/skills of the current project.

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

Sponsors

Details

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

More from chaterm/terminal-skills

All 5
1nansen-ai avatarnansen-agent-guidenansen-ai/nansen-cliRouting guide -- when to use `nansen agent` (AI research) vs direct CLI data commands. Use when deciding how to answer a user's research question with Nansen to240skills.sh installs
2vangongwanxiaowan avatardrama-plannervangongwanxiaowan/screen-creative-skillsdrama planner234skills.sh installs
3rudrankriyam avatargpd-build-lifecyclerudrankriyam/app-store-connect-cli-skillsgpd build lifecycle227skills.sh installs
4crossmint avatarlobstercashcrossmint/lobstercash-cli-skillsUse this skill when the user wants to spend money, make purchases, send crypto, pay for APIs, browse websites for shopping, complete checkout, or manage an AI a226skills.sh installs
5rudrankriyam avatargpd-betagroupsrudrankriyam/app-store-connect-cli-skillsgpd betagroups224skills.sh installs
6rudrankriyam avatargpd-submission-healthrudrankriyam/app-store-connect-cli-skillsgpd submission health222skills.sh installs