-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsystemd.cheat
160 lines (116 loc) · 2.87 KB
/
systemd.cheat
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
% systemd
;
; Power management
;
# [systemctl] [power] system reboot - 重启
systemctl reboot
# [systemctl] [power] system power off - 关机
systemctl poweroff
# [systemctl] [power] suspend - 挂起
systemctl suspend
# [systemctl] [power] hibernation - 休眠
systemctl hibernate
# [systemctl] [power] hybrid-sleep - 休眠并挂起
systemctl hybrid-sleep
;
; Units
;
# [systemctl] [units] [list] units in memory - 列出当前运行的units, systemctl不带参数时的默认行为
systemctl list-units
# [systemctl] [units] [list] list failed units - 列出运行失败的units
systemctl --failed
# [systemctl] [units] [show] runtime status - 查看unit运行时状态, 若不指定unit, 默认为查看系统状态
systemctl status <units_or_pid>
# [systemctl] [units] [show] manual page - 列出units的帮助文档
systemctl help <units>
# [systemctl] [units] [show] properties - 列出units的属性
systemctl show <units>
# [systemctl] [units] [show] file - 列出units的文件内容
systemctl cat <units>
# [systemctl] [units] [edit] override, which will creat '.d/override.conf'
systemctl edit <units>
# [systemctl] [units] [check] whether is enable
systemctl is-enabled <units>
# [systemctl] [units] [check] whether is active
systemctl is-active <units>
# [systemctl] [units] [check] whether is failed
systemctl is-failed <units>
# [systemctl] [units] start
systemctl start <units>
# [systemctl] [units] stop
systemctl stop <units>
# [systemctl] [units] restart
systemctl restart <units>
# [systemctl] [units] reload
systemctl reload <units>
# [systemctl] [units] mask
systemctl mask <units>
# [systemctl] [units] unmask
systemctl unmask <units>
# [systemctl] [units] daemon-reload - 重载unit的改动到systemd
systemctl daemon-reload
;
; Target
;
# [systemctl] [target] get the default target
systemctl get-default
# [systemctl] [target] set the default target
systemctl set-default <target>
;
; Hostname
;
# [hostnamectl] hostname
hostnamectl
;
; Locale
;
# [localectl] locale
localectl
;
; Time
;
# [timedatectl] timedate
timedatectl
;
; Login
;
# [loginctl] login
loginctl
;
; Network
;
# [networkctl] network
networkctl
# [networkctl] restart NIC
sudo networkctl down <nic>; sudo networkctl up <nic>
$ nic: networkctl list --no-legend | awk '{print $2}'
;
; DNS
;
# [resolvectl] DNS
resolvectl
;
; log
;
# [journalctl] kernel message from the current boot
journalctl -k
# [journalctl] follow the log - 实时滚动
journalctl -f
# [journalctl] unit log - 指定unit的log
journalctl -u <unit>
# [journalctl] log disk usage - log的占用情况
journalctl --disk-usage
;
; coredump
;
# [coredumpctl] coredump
coredumpctl
;
; systemd-analyze
;
# [systemd-analyze] show bootup statistics
systemd-analyze
# [systemd-analyze] show detailed bootup time for each unit
systemd-analyze blame
# [systemd-analyze] show configuration file and drop-ins
systemd-analyze cat-config <file>