Skip to content

Commit 90c9fef

Browse files
committed
feat: add systemd.md cheatsheet. (jaywcjlove#34)
1 parent 29f3b97 commit 90c9fef

File tree

3 files changed

+69
-0
lines changed

3 files changed

+69
-0
lines changed

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -116,6 +116,7 @@ Quick Reference
116116
[Lsof](./docs/lsof.md)<!--rehype:style=background: rgb(16 185 129/var(\-\-bg\-opacity));-->
117117
[Netcat](./docs/netcat.md)<!--rehype:style=background: rgb(4 92 135/var(\-\-bg\-opacity));-->
118118
[Sed](./docs/sed.md)<!--rehype:style=background: rgb(16 185 129/var(\-\-bg\-opacity));-->
119+
[Systemd](./docs/systemd.md)<!--rehype:style=background: rgb(16 185 129/var(\-\-bg\-opacity));-->
119120
[SSH](./docs/ssh.md)<!--rehype:style=background: rgb(99 99 99/var(\-\-bg\-opacity));-->
120121
[Screen](./docs/screen.md)<!--rehype:style=background: rgb(99 99 99/var(\-\-bg\-opacity));-->
121122
[Tmux](./docs/tmux.md)<!--rehype:style=background: rgb(99 99 99/var(\-\-bg\-opacity));-->

docs/systemd.md

Lines changed: 66 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,66 @@
1+
Systemd
2+
===
3+
4+
最常用的 [Systemd](https://systemd.io/) 命令备忘单快速参考
5+
6+
命令
7+
----
8+
9+
### 查看系统信息
10+
11+
:- | -
12+
:- | -
13+
`systemctl list-dependencies` | 显示单元的依赖关系
14+
`systemctl list-sockets` | 列出套接字和激活的内容
15+
`systemctl list-jobs` | 查看活动的 systemd 作业
16+
`systemctl list-unit-files` | 查看单元文件及其状态
17+
`systemctl list-units` | 显示单位是否已加载/活动
18+
`systemctl get-default` | 列出默认目标(如运行级别)
19+
<!--rehype:className=style-list-->
20+
21+
### 使用服务
22+
<!--rehype:wrap-class=row-span-2-->
23+
24+
:- | -
25+
:- | -
26+
`systemctl stop service` | <red>停止</red>正在运行的服务
27+
`systemctl start service` | 启动服务
28+
`systemctl restart service` | 重新启动正在运行的服务
29+
`systemctl reload service` | 重新加载服务中的所有配置文件
30+
`systemctl daemon-reload` | 必须运行以重新加载更改的单元文件
31+
`systemctl status` | service 查看服务是否正在运行/启用
32+
`systemctl --failed` | 显示未能运行的服务
33+
`systemctl reset-failed` | 将任何单位从失败状态重置
34+
`systemctl enable service` | 使服务在启动时启动
35+
`systemctl disable service` | 禁用服务 - 不会在启动时启动
36+
`systemctl show service` | 显示服务(或其他单元)的属性
37+
`systemctl edit service` | 创建片段以放入单元文件
38+
`systemctl edit --full service` | 编辑整个单元文件以进行服务
39+
`systemctl -H host status network` | 远程运行任何 systemctl 命令
40+
<!--rehype:className=style-list-->
41+
42+
### 改变系统状态
43+
44+
:- | -
45+
:- | -
46+
`systemctl reboot` | 重启系统(reboot.target)
47+
`systemctl poweroff` | 关闭系统(poweroff.target)
48+
`systemctl emergency` | 进入紧急模式(emergency.target)
49+
`systemctl default` | 返回默认目标(multi-user.target)
50+
<!--rehype:className=style-list-->
51+
52+
### 查看日志消息
53+
54+
:- | -
55+
:- | -
56+
`journalctl` | 显示所有收集的日志消息
57+
`journalctl -u network.service` | 查看网络服务消息
58+
`journalctl -f` | 关注出现的消息
59+
`journalctl -k` | 仅显示内核消息
60+
<!--rehype:className=style-list-->
61+
62+
另见
63+
---
64+
65+
- [Systemd 官网](https://systemd.io/) _(systemd.io)_
66+
- [Systemd Cheat Sheet](https://access.redhat.com/sites/default/files/attachments/12052018_systemd_6.pdf) _(access.redhat.com)_

scripts/assets/systemd.svg

Lines changed: 2 additions & 0 deletions
Loading

0 commit comments

Comments
 (0)