实验一
一、实训题目
查看进程
二、实训目的
(1)熟悉 Linux 进程参数。
(2)掌握 ps 命令和 top 命令的使用。
三、实训内容及步骤
(1)使用 ps 命令监控后台进程的工作情况,尝试 aux 选项组合的使用。
在终端上输入“ps aux”

(2)ps 命令结合管道操作符和 less(more)命令查看进程。
在终端上输入“ps aux | less”

(3)使用 top 命令动态显示系统进程信息。
在终端上输入“top”

实验二
一、实训题目
单元管理与单元文件管理操作
二、实训目的
(1)熟悉单元管理与单元文件背景知识。
(2)掌握使用 systemctl 命令管理单元和单元文件。
三、实训内容及步骤
(1)使用 systemctl list-units 命令查看单元。
在终端上输入“systemctl list-units”

(2)使用 systemctl status 命令查看单元状态。
在终端上输入”systemctl status”

(3)使用 systemctl start 等命令转换特定单元的状态。
在终端上输入“systemctl start”

(4)使用 systemctl list-dependencies 命令查看单元的依赖关系。
在终端上输入“systemctl list-dependencies”

(5)使用 systemctl list-unit-files 命令查看单元文件。
在终端上输入“systemctl list-unit-files” 
(6)使用 systemctl status 命令查看单元文件的状态。
在终端上输入“systemctl status” 
(7)使用 systemctl enable 等命令实现单元文件状态转换。
在终端上输入“systemctl enable”

实验三
实训题目
整理 systemctl 电源管理命令
实验步骤
|
功能 |
传统命令 |
systemd命令 |
|
关机(停止系统) |
hatl |
Systemctl halt |
|
关机(关闭系统电源) |
poweroff |
Systemctl powerof |
|
重启系统 |
reboot |
Systemctl reboot |
|
挂起(暂停系统) |
Pm-suspend |
Systemctl suspend |
|
休眠系统(快照) |
Pm-hibernate |
Systemctl hibernate |
|
暂停并休眠系统 |
Pm-suspend-hybrid |
Systemctl hybrid-sleep |
实验四
一、实训题目
systemd 日志管理
二、实训目的
(1)熟悉 systemd 日志背景知识。
(2)掌握 systemd 日志的查看命令。
三、实训内容及步骤
(1)按条目数查看日志。
在终端上输入“journalctl -n” 
(2)按类别查看日志。
在终端上输入“journalctl -p err” 
(3)按时间范围查看日志。
在终端上输入“journalctl --since today” 
(4)指定日志显示格式。
在终端上输入“journalctl -o json” 
(5)查询某单元(服务)日志。
在终端上输入“journalctl --user” 
(6)组合查询日志。
在终端上输入“journalctl -u sun --since=yesterday --utc”

实验总结
通过本次实验:学习了ps 命令和 top 命令的使用和 systemctl 电源管理命令以及单元管理与单元文件背景知识。掌握使用了systemctl 命令管理单元和单元文件整理。在systemd 日志背景知识和systemd 日志的查看命令的实验里,对journalctl命令掌握的并不彻底,需要课后学习。
本文介绍了四个实验,涉及Linux中查看和管理进程的ps与top命令,使用systemctl进行单元管理和单元文件操作,以及systemd的日志管理。实验涵盖了从基础的进程查看到系统的电源管理,再到日志查询的多个方面,强调了systemctl命令在系统管理中的重要性,并指出对journalctl日志查询命令的深入理解需要进一步学习。

1万+

被折叠的 条评论
为什么被折叠?



