马哥博客作业第三周

1.使用sed命令打印出/etc/passwd文件中的奇数行内容

  sed -n '1~2p' /etc/passwd

2.使用sed命令将/etc/passwd文件从2到10行中的bin替换成linux

 sed -n '2,10s@\<bin\>@linux@gp' /etc/passwd

3.使用sed命令显示/etc/passwd文件的最后一行信息内容

  sed -n '$p' /etc/passwd 

4.使用sed命令删除/etc/fstab文件中所有以'#'为注释的行和其后面紧挨着的空白字符,达到去除注释的目的

  sed -r '/^#[[:space:]]?/d' /etc/fstab 

5.使用sed命令将/etc/passwd前三行信息保存至/root/file.txt

  sed -n '1,3w/root/file.txt' /etc/passwd

6.使用rpm命令安装、卸载、更新、ntp-0.7.12x86_64.rpm软件包

  安装命令:rpm -ivh ntp-0.7.12x86_64.rpm

  卸载命令:rpm -e ntp-0.7.12x86_64.rpm

  更新命令:rpm -Uvh ntp-0.7.12x86_64.rpm

 7.哪个命令可查看安装openssl.x86.rpm包的依赖关系,查询会安装哪几个文件,分别到哪个目录,而不实际安装?如何查询openssl安装的时间?如何查看/usr/lib/libssl.so6属于哪个包安装的

   查询依赖关系、安装文件及目录:rpm -qlR openssl

   查询openssl安装时间 :rpm -qi openssl

   查询/usr/lib/libssl.so6属于哪个包安装:rpm -qf /usr/lib/libssl.so6

 8.实现开机自动挂在光盘

   yum -y install autofs;systemctl enable --now autofs

 9.查询系统是否安装redis软件s

   rpm -qa  redis

posted @ 2020-06-14 23:09  小小小小石头  阅读(149)  评论(0)    收藏  举报