N46期第三周作业

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

    [root@centos8 ~]# sed -n -e '1~2p' -e '=' /etc/passwd
    
  2. 使用 sed 命令将 /etc/passwd 文件从 2 到 10 行中的 bin 替换成 linux ?

    [root@centos8 ~]# sed -n '2,10 s/bin/linux/gp' /etc/passwd
    
  3. 使用 sed 命令显示 /etc/passwd 文件的最后一行信息内容

    [root@centos8 ~]# sed -n '$p' /etc/passwd
    
  4. 使用 sed 命令删除 /etc/fstab 文件中所有以 '#' 为注释的行和其后面紧挨着的空白字符,达到去除注释的目的

    [root@centos8 ~]# sed -E 's/^# //g' /etc/fstab 
    
  5. 使用 sed 命令将 /etc/passwd 前三行信息保存至 /root/file.txt 文件中

    cat /etc/passwd | sed -n '1,3 w /root/file.txt'
    
  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.so.6属于哪个包安装的

    #查询依赖关系:  	rpm -qRp openssl.x86.rpm;
    #查询安装文件:        rpm -ql openssl.x86.rpm;
    #查询安装时间:  	yum history grep openssl
    #查询属于哪个包:      rpm -qf /usr/lib/libssl.so.6
    
  8. 实现开机自动挂载光盘

    yum install autofs -y;systemctl enable --now autofs	
    
  9. 查看系统是否安装reids软件

    rpm -qa redis
    
posted @ 2020-06-16 19:55  晓氵十  阅读(69)  评论(0编辑  收藏  举报