制作service列表并打印出來
在Linux中,服務(Service)是指常駐在內存中的進程,這些進程通常監聽某個端口,等待其他程序的請求。服務也被稱為守護進程(Daemon),它們提供了系統所需的各種功能,如Web服務、數據庫服務等。面對上百個服務,需要制作一份列表有服務名稱和對應簡單解釋這些服務是什么作用的。
一、將service列表保存到文本文件service.list.txt中
普通用戶切換到root用戶輸入以下命令查看系統中所有的服務列表
應用程序——工具——終端
ruhong@localhost:~> su -
密碼:
localhost:~ # systemctl list-unit-files --type=service
UNIT FILE STATE PRESET
accounts-daemon.service disabled disabled
alsa-restore.service static -
alsa-state.service static -
alsasound.service alias -
apparmor.service enabled enabled
…………
localhost:~ # systemctl list-units --all --type=service
UNIT LOAD ACTIVE SUB DESCRIPTION
accounts-daemon.service loaded active running Accounts Service
acpid.service not-found inactive dead acpid.service
alsa-restore.service loaded active exited Save/Restore Sound Card State
alsa-state.service loaded inactive dead Manage Sound Card State (restore and store)
amavis.service not-found inactive dead amavis.service
apparmor.service loaded active exited Load AppArmor profiles
…………
enabled:已建立啟動鏈接
disabled:沒建立啟動鏈接
static:該配置文件沒有 [Install] 部分(無法執行),只能作為其他配置文件的依賴
Alias:當前 Unit 可用于啟動的別名,通常是在/etc/systemd/system/文件夾中的軟鏈接
systemctl list-units --all有描述description部分,大略解釋每個服務是干什么事務的,所以要將這個命令輸出到屏幕的全部內容保存到文本文件中
localhost:~ # systemctl list-units --all --type=service > service.list.txt
應用程序——附件——Gedit文本編輯器——打開service.list.txt,通過查找和全部替換功能,將文中所有的大圓圖標●去掉,刪除最后的5行文字解釋
localhost:~ # cat service.list.txt |wc -l
162
統計service.list.txt有162行文字,就是有161個服務
二、在辦公word文檔制作表格填入service.list.txt的內容
應用程序——辦公——WPS文字——新建空白文檔——文件——頁面設置——頁邊距上下左右都為0.8厘米——確定
插入——表格——插入表格——列數輸入2,行數輸入162——確定
localhost:~ # awk ‘{print $1}’ service.list.txt > service.list01.txt
輸出service.list.txt文件中的第一列內容保存到文本文件service.list01.txt中,使用gedit文本編輯器打開service.list01.txt,組合鍵Ctrl+A選擇全部——組合鍵Ctrl+C復制
WPS文字表格——使用鼠標左鍵選擇第一列的所有空格——鼠標右擊所選擇空格——粘貼——完成將第一列內容填入第一列表格
localhost:~ # awk ‘($1=“”) ($2=“”) ($3=“”) ($4=“”); {print $0}’ service.list.txt > service.list05.txt
只要第五列DESCRIPTION的所有內容,設置前四列的列號為空值,就不會顯示前四列的內容——輸出service.list.txt文件中的第五列內容保存到文本文件service.list05.txt中,使用gedit文本編輯器打開service.list05.txt,使用鼠標選擇段首空格——組合鍵Ctrl+C復制——組合鍵Ctrl+H替換——保持替換為無,單擊全部替換——組合鍵Ctrl+A選擇全部——組合鍵Ctrl+C復制
WPS文字表格——使用鼠標左鍵選擇第二列的所有空格——鼠標右擊所選擇空格——粘貼——完成將第五列內容填入第二列表格——調整兩列之間的中間豎線能顯示兩邊內容,請自行摸索,我也無法使用文字表達
組合鍵Ctrl+A全選整個表格——單擊兩次A+圖標讓字體大小變為小四——保存文檔
三、用A4紙雙面打印表格
表格有4頁,使用兩張A4紙雙面打印,要打印整個文檔了,不要總想到在windows打印,不要小看現代linux系統對打印的適配支持,請自行摸索在linux系統使用打印機的方法
打開打印機放入兩張紙——鼠標單擊表格中任何一個單元格——組合鍵Ctrl+P出現打印對話框——在頁碼范圍輸入1,3——確定,注意是英文逗號
將兩張紙翻面放入打印機——鼠標單擊表格中任何一個單元格——組合鍵Ctrl+P出現打印對話框——在頁碼范圍輸入2,4——確定,注意是英文逗號
四、寫上親筆簽名
在頁底手寫頁碼,在最后一頁底寫上自己的親筆簽名和打印日期,雖然只是給自己看,但還是要寫上自己的親筆簽名和日期,這是為自己的勞動成果而簽名
Even if you get no applause, you should accept a curtain call gracefully and appreciate your own efforts.
即使沒有人為你鼓掌,也要優雅的謝幕,感謝自己的認真付出。
《美國曝出重大丑聞:拜登可能根本“沒當過”總統!拜登總統任期內幾乎所有文件都由自動簽名筆簽署》
五、還有target列表,要你自己練習制作
localhost:~ # systemctl list-units --all --type=target
UNIT LOAD ACTIVE SUB DESCRIPTION
cryptsetup-pre.target loaded inactive dead Local Encrypted Volumes (Pre)
cryptsetup.target loaded active active Local Encrypted Volumes
display-manager.target not-found inactive dead display-manager.target
emergency.target loaded inactive dead Emergency Mode
first-boot-complete.target loaded inactive dead First Boot Complete
…………