這期內(nèi)容當(dāng)中小編將會(huì)給大家?guī)碛嘘P(guān)systemctl用法及其語法是什么,文章內(nèi)容豐富且以專業(yè)的角度為大家分析和敘述,閱讀完這篇文章希望大家可以有所收獲。
1.確定是否安裝systemd及其版本
# systemctl –version
2.確定systemd和systemctl的二進(jìn)制文件和庫文件的安裝位置
# whereis systemd
# whereis systemctl
3.確定systemd是否運(yùn)行
# ps -eaf | grep [s]ystemd
4.分析systemd啟動(dòng)進(jìn)程
# systemd-analyze
5.分析啟動(dòng)時(shí)各個(gè)進(jìn)程花費(fèi)的時(shí)間
# systemd-analyze blame
6. 分析啟動(dòng)時(shí)的關(guān)鍵鏈
# systemd-analyze critical-chain
7.列出所有可用單元
# systemctl list-unit-files
8.列出所有運(yùn)行中單元
# systemctl list-units
9.列出所有失敗單元
# systemctl --failed
10. 確定某個(gè)單元(如 nfs.service)是否啟用
# systemctl is-enabled nfs.service
11.確定某個(gè)單元或服務(wù)是否運(yùn)行
# systemctl status nfs.service
12. 列出所有服務(wù)(包括啟用的和禁用的)
# systemctl list-unit-files --type=service
13.啟動(dòng)、重啟、停止、重載服務(wù)及確定服務(wù)(如 nfs.service)狀態(tài)
# 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命令,終端并不輸出任何相關(guān)信息,但可以通過status命令獲取。
14.激活并配置服務(wù)自啟和禁用服務(wù)
# systemctl is-active nfs.service
# systemctl enable nfs.service
# systemctl disable nfs.service
15.屏蔽(禁止任何方式啟動(dòng)服務(wù),其比disabled作用更強(qiáng))或解除屏蔽服務(wù)
# systemctl mask nfs.service
# systemctl unmask nfs.service
16.殺死服務(wù)
# systemctl kill nfs
# systemctl status nfs
17.列出所有系統(tǒng)掛載點(diǎn)
# systemctl list-unit-files --type=mount
18.掛載、卸載、重新掛載、重載系統(tǒng)掛載點(diǎn)和確定系統(tǒng)掛載點(diǎn)狀態(tài)
# systemctl start tmp.mount
# systemctl stop tmp.mount
# systemctl restart tmp.mount
# systemctl reload tmp.mount
# systemctl status tmp.mount
19. 啟動(dòng)時(shí)激活、啟用(自動(dòng)掛載)或禁用掛載點(diǎn)
# systemctl is-active tmp.mount
# systemctl enable tmp.mount
# systemctl disable tmp.mount
20.屏蔽(使其不能啟用)或解屏蔽掛載點(diǎn)
# systemctl mask tmp.mount
# systemctl unmask tmp.mount
21. 列出所有可用套接字
# systemctl list-unit-files --type=socket
22. 啟動(dòng)、重啟、停止、重載套接字并確認(rèn)其狀態(tài)
# systemctl start cups.socket
# systemctl restart cups.socket
# systemctl stop cups.socket
# systemctl reload cups.socket
# systemctl status cups.socket
23.系統(tǒng)啟動(dòng)時(shí)激活套接口,并啟用(自啟)或禁用該套接字
# systemctl is-active cups.socket
# systemctl enable cups.socket
# systemctl disable cups.socket
24.屏蔽(使其不能啟動(dòng))或解屏蔽套接字
# systemctl mask cups.socket
# systemctl unmask cups.socket
25.獲取某個(gè)服務(wù)的CPU配額
# systemctl show -p CPUShares nfs.service
26.限制某個(gè)服務(wù)的CPU配額為2000
# systemctl set-property nfs.service CPUShares=2000
# systemctl show -p CPUShares nfs.service
--注:
1)當(dāng)為某個(gè)服務(wù)設(shè)置CPU配額時(shí),系統(tǒng)會(huì)以服務(wù)名為名字創(chuàng)建一個(gè)目錄(如 nfs.service),其中包含一個(gè)名為90-CPUShares.conf的文件,該文件包含CPUShare限制的相關(guān)信息,可以用如下方式查看該文件。
# vi /etc/systemd/system/nfs.service.d/90-CPUShares.conf
27. 確定某個(gè)服務(wù)的所有配置信息
# systemctl show nfs
28. 分析某個(gè)服務(wù)的關(guān)鍵鏈
# systemd-analyze critical-chain nfs.service
29.獲取某個(gè)服務(wù)的依賴性關(guān)系
# systemctl list-dependencies nfs.service
30.按等級(jí)列出控制組
# systemd-cgls
31.按CPU、內(nèi)存、輸入和輸出列出控制組
# systemd-cgtop
32.進(jìn)入系統(tǒng)救援模式
# systemctl rescue
33.進(jìn)入緊急模式
# systemctl emergency
34. 確認(rèn)當(dāng)前的運(yùn)行等級(jí)
# systemctl get-default
35.進(jìn)入相應(yīng)運(yùn)行等級(jí)
--圖形模式(5)
# systemctl isolate runlevel5.target
或
# systemctl isolate graphical.target
--多用戶模式(3)
# systemctl isolate runlevel3.target
或
# systemctl isolate multiuser.target
36.設(shè)置默認(rèn)運(yùn)行等級(jí)
# systemctl set-default runlevel3.target
或
# systemctl set-default runlevel5.target
37.使系統(tǒng)重啟、停止、掛起、休眠或進(jìn)入混合睡眠
# systemctl reboot
# systemctl halt
# systemctl suspend
# systemctl hibernate
# systemctl hybrid-sleep
--注:
1)Runlevel 0 : 關(guān)閉系統(tǒng)。
2)Runlevel 1 : 救援維護(hù)模式。
3)Runlevel 3 : 多用戶,無圖形模式。
4)Runlevel 4 : 系統(tǒng)未使用,保留。
5)Runlevel 5 : 多用戶,圖形化模式。
6)Runlevel 6 : 關(guān)閉并重啟系統(tǒng)。
上述就是小編為大家分享的systemctl用法及其語法是什么了,如果剛好有類似的疑惑,不妨參照上述分析進(jìn)行理解。如果想知道更多相關(guān)知識(shí),歡迎關(guān)注創(chuàng)新互聯(lián)-成都網(wǎng)站建設(shè)公司行業(yè)資訊頻道。
當(dāng)前文章:systemctl用法及其語法是什么-創(chuàng)新互聯(lián)
分享網(wǎng)址:http://www.rwnh.cn/article30/djpjso.html
成都網(wǎng)站建設(shè)公司_創(chuàng)新互聯(lián),為您提供手機(jī)網(wǎng)站建設(shè)、云服務(wù)器、網(wǎng)站維護(hù)、全網(wǎng)營銷推廣、定制開發(fā)、ChatGPT
聲明:本網(wǎng)站發(fā)布的內(nèi)容(圖片、視頻和文字)以用戶投稿、用戶轉(zhuǎn)載內(nèi)容為主,如果涉及侵權(quán)請(qǐng)盡快告知,我們將會(huì)在第一時(shí)間刪除。文章觀點(diǎn)不代表本網(wǎng)站立場(chǎng),如需處理請(qǐng)聯(lián)系客服。電話:028-86922220;郵箱:631063699@qq.com。內(nèi)容未經(jīng)允許不得轉(zhuǎn)載,或轉(zhuǎn)載時(shí)需注明來源: 創(chuàng)新互聯(lián)
猜你還喜歡下面的內(nèi)容