范例一:列出系
统
上面有
启动
的
unit
[root@study ~]#
systemctl
UNIT LOAD ACTIVE SUB DESCRIPTION
proc
-
sys
-
fs
-
binfmt_mis... loaded active waiting Arbitrary Executable File Formats File System
sys
-
devices
-
pc...:0:1:... loaded active plugged QEMU_HARDDISK
sys
-
devices
-
pc...0:1
-
0... loaded active plugged QEMU_HARDDISK
sys
-
devices
-
pc...0:0
-
1... loaded active plugged QEMU_DVD
-
ROM
.....(
中
间
省略
).....
vsftpd.service loaded active running Vsftpd ftp daemon
.....(
中
间
省略
).....
cups.socket
loaded failed failed CUPS Printing Service Sockets
.....(
中
间
省略
).....
LOAD = Reflects whether the unit definition was properly loaded.
ACTIVE = The high
-
level unit activation state, i.e. generalization of SUB.
SUB = The low
-
level unit activation stat
e, values depend on unit type.
141 loaded units listed. Pass
--
all to see loaded but inactive units, too.
To show all installed unit files use 'systemctl list
-
unit
-
files'.
#
列出的
项
目中,主要的意
义
是:
# UNIT
:
项
目的名
称
,包括各
个
unit
的
类别
(
看
扩
展名
)
# LOAD
:
开
机
时
是否
会
被加
载
,默
认
systemctl
显
示的是有加
载
的
项
目而已喔!
# ACTIVE
:目前的
状态
,
须
与后
续
的
SUB
搭配!就是我
们
用
systemctl status
观
察
时
,
active
的
项
目!
# DESCRIPTION
:
详细
描述
啰
# cups
比
½
有趣,因
为刚刚
被我
们
玩
过
,所以
ACTIVE
竟然是
failed
的喔!被玩死了!
^_^
#
另外,
systemctl
都不加
参数
,其
实预设
就是
list
-
units
的意思!
范例二:列出所有已
经
安
装
的
unit
有哪些?
[root@study ~]#
systemctl list
-
unit
-
files
UNIT FILE STATE
proc
-
sys
-
fs
-
binfmt_misc.automount static
dev
-
hugepages.mount static
dev
-
mqueue.mount static
proc
-
fs
-
nfsd.mount
static
.....(
中
间
省略
).....
systemd
-
tmpfiles
-
clean.timer static
336 unit files listed.
使用
systemctl list-unit-files
会½系统上所有的服务通通列出来~而不像
list-units
½以
unit
分类作
大致的说明。
至于
STATE
状态就是前两个小½谈到的开机是否会加载的那个状态项目啰!主要有
enabled / disabled / mask / static
等等。