系统管理11-系统进程与计划任务管理 练习题

一、经过ps命令的两种选项形式查看进程信息
[root@localhost ~]# ps aux
[root@localhost ~]# ps -elf
二、经过top命令查看进程
[root@localhost ~]# top
三、经过pgrep命令查看sshd服务的进程号
[root@localhost ~]# pgrep -l sshd
1166 sshd
13754 sshd
四、查看系统进程树
[root@localhost ~]# pstree -a
五、使dd if=/dev/zero of=/root/file bs=1M count=8190 命令操做在前台运行
[root@localhost ~]# dd if=/dev/zero of=/root/file bs=1M count=8190
六、将第5题命令操做调入到后台并暂停
^Z
[1]+  已中止               dd if=/dev/zero of=/root/file bs=1M count=8190
[root@localhost ~]# jobs 1
[1]+  已中止               dd if=/dev/zero of=/root/file bs=1M count=8190

七、使dd if=/dev/zero of=/root/file2 bs=1M count=1024 命令操做在后台运行
[root@localhost ~]# dd if=/dev/zero of=/root/file2 bs=1M count=1024 &
[2] 54226
八、查看后台的任务列表
[root@localhost ~]# jobs 2
[2]-  运行中               dd if=/dev/zero of=/root/file2 bs=1M count=1024 &
九、恢复dd if=/dev/zero of=/root/file bs=1M count=8190 让其在后台继续运行
[root@localhost ~]# bg 1
[root@localhost ~]# jobs 1
[1]+  运行中               dd if=/dev/zero of=/root/file bs=1M count=8190 &
十、查询dd if=/dev/zero of=/root/file bs=1M count=8190 命令的进程并经过kill杀死
[root@localhost ~]# pgrep -l "dd"
2 kthreadd
41 ipv6_addrconf
13354 evolution-addre
13380 evolution-addre
15780 dd
[root@localhost ~]# kill -9 15780
[root@localhost ~]# jobs 1
[1]+  已杀死               dd if=/dev/zero of=/root/file bs=1M count=8190
十一、设置一次性计划任务在18:00时关闭系统,并查看任务信息
[root@localhost ~]# at 18:00
at> init 0
at> <EOT>
job 2 at Thu Aug  8 18:00:00 2019
[root@localhost ~]# atq
2 Thu Aug  8 18:00:00 2019 a root
十二、以root身份设置周期性计划任务
a) 天天晚上的24点时打包压缩 /etc/passwd /etc/shadow /etc/group /etc/gshadow 为 file.tar.gz
[root@localhost ~]# crontab -e
0       0       *       *       *       /usr/bin/tar cfz file.tar.gz /etc/passwd /etc/shadow /etc/group /etc/gshadow
b) 每周一的每隔五分钟列出磁盘使用情况
*/5     *       *       *       1       du -as
c) 天天的8:30与互联网时间同步服务器pool.ntp.org同步时间
30      8       *       *       *       ntpdate pool.ntp.org
1三、经过crontab命令查看root的计划任务,经过文件查看类工具列出/var/spool/cron下对应的文件内容
[root@localhost ~]# crontab -l
0 0 * * * /usr/bin/tar cfz file.tar.gz /etc/passwd /etc/shadow /etc/group /etc/gshadow
*/5 * * * 1 du -as
30 8 * * * ntpdate pool.ntp.org
[root@localhost ~]# ls /var/spool/cron/
root
[root@localhost ~]# vim /var/spool/cron/root 0       0       *       *       *       /usr/bin/tar cfz file.tar.gz /etc/passwd /etc/shadow /etc/group /etc/gshadow */5     *       *       *       1       du -as 30      8       *       *       *       ntpdate pool.ntp.org ~                                                                                  ~                                                                                  ~                                                                                  ~                                                                                  ~                                                                                  ~                                                                                  "/var/spool/cron/root" 3L, 138C 已写入                         
相关文章
相关标签/搜索