制作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
…………