1.肯定是否安裝systemd及其版本socket
# systemctl –versionhibernate
2.肯定systemd和systemctl的二進制文件和庫文件的安裝位置rest
# whereis systemd接口
# whereis systemctl進程
3.肯定systemd是否運行內存
# ps -eaf | grep [s]ystemdci
4.分析systemd啓動進程get
# systemd-analyzeit
5.分析啓動時各個進程花費的時間io
# systemd-analyze blame
6. 分析啓動時的關鍵鏈
# systemd-analyze critical-chain
7.列出全部可用單元
# systemctl list-unit-files
8.列出全部運行中單元
# systemctl list-units
9.列出全部失敗單元
# systemctl --failed
10. 肯定某個單元(如 nfs.service)是否啓用
# systemctl is-enabled nfs.service
11.肯定某個單元或服務是否運行
# systemctl status nfs.service
12. 列出全部服務(包括啓用的和禁用的)
# systemctl list-unit-files --type=service
13.啓動、重啓、中止、重載服務及肯定服務(如 nfs.service)狀態
# systemctl start nfs.service
# systemctl restart nfs.service
# systemctl stop nfs.service
# systemctl reload nfs.service
# systemctl status nfs.service
--注:
1)Systemctl的start,restart,stop和reload命令,終端並不輸出任何相關信息,但能夠經過status命令獲取。
14.激活並配置服務自啓和禁用服務
# systemctl is-active nfs.service
# systemctl enable nfs.service
# systemctl disable nfs.service
15.屏蔽(禁止任何方式啓動服務,其比disabled做用更強)或解除屏蔽服務
# systemctl mask nfs.service
# systemctl unmask nfs.service
16.殺死服務
# systemctl kill nfs
# systemctl status nfs
17.列出全部系統掛載點
# systemctl list-unit-files --type=mount
18.掛載、卸載、從新掛載、重載系統掛載點和肯定系統掛載點狀態
# systemctl start tmp.mount
# systemctl stop tmp.mount
# systemctl restart tmp.mount
# systemctl reload tmp.mount
# systemctl status tmp.mount
19. 啓動時激活、啓用(自動掛載)或禁用掛載點
# systemctl is-active tmp.mount
# systemctl enable tmp.mount
# systemctl disable tmp.mount
20.屏蔽(使其不能啓用)或解屏蔽掛載點
# systemctl mask tmp.mount
# systemctl unmask tmp.mount
21. 列出全部可用套接字
# systemctl list-unit-files --type=socket
22. 啓動、重啓、中止、重載套接字並確認其狀態
# systemctl start cups.socket
# systemctl restart cups.socket
# systemctl stop cups.socket
# systemctl reload cups.socket
# systemctl status cups.socket
23.系統啓動時激活套接口,並啓用(自啓)或禁用該套接字
# systemctl is-active cups.socket
# systemctl enable cups.socket
# systemctl disable cups.socket
24.屏蔽(使其不能啓動)或解屏蔽套接字
# systemctl mask cups.socket
# systemctl unmask cups.socket
25.獲取某個服務的CPU配額
# systemctl show -p CPUShares nfs.service
26.限制某個服務的CPU配額爲2000
# systemctl set-property nfs.service CPUShares=2000
# systemctl show -p CPUShares nfs.service
--注:
1)當爲某個服務設置CPU配額時,系統會以服務名爲名字建立一個目錄(如 nfs.service),其中包含一個名爲90-CPUShares.conf的文件,該文件包含CPUShare限制的相關信息,能夠用以下方式查看該文件。
# vi /etc/systemd/system/nfs.service.d/90-CPUShares.conf
27. 肯定某個服務的全部配置信息
# systemctl show nfs
28. 分析某個服務的關鍵鏈
# systemd-analyze critical-chain nfs.service
29.獲取某個服務的依賴性關係
# systemctl list-dependencies nfs.service
30.按等級列出控制組
# systemd-cgls
31.按CPU、內存、輸入和輸出列出控制組
# systemd-cgtop
32.進入系統救援模式
# systemctl rescue
33.進入緊急模式
# systemctl emergency
34. 確認當前的運行等級
# systemctl get-default
35.進入相應運行等級
--圖形模式(5)
# systemctl isolate runlevel5.target
或
# systemctl isolate graphical.target
--多用戶模式(3)
# systemctl isolate runlevel3.target
或
# systemctl isolate multiuser.target
36.設置默認運行等級
# systemctl set-default runlevel3.target
或
# systemctl set-default runlevel5.target
37.使系統重啓、中止、掛起、休眠或進入混合睡眠
# systemctl reboot
# systemctl halt
# systemctl suspend
# systemctl hibernate
# systemctl hybrid-sleep
--注:
1)Runlevel 0 : 關閉系統。
2)Runlevel 1 : 救援維護模式。
3)Runlevel 3 : 多用戶,無圖形模式。
4)Runlevel 4 : 系統未使用,保留。
5)Runlevel 5 : 多用戶,圖形化模式。
6)Runlevel 6 : 關閉並重啓系統。