N46026-第三周

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

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

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

     cat /etc/passwd.back | sed -n '2,10p' | sed 's/bin/linux/g'

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

     sed -n '$p' /etc/passwd

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

      sed '/^#/d' /etc/passwd.back

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

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

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

     安装  rpm -ivh ntp-0.7.12x86_64.rpm
     卸载  rpm -ev 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 -qpR openssl.x86.rpm

     查看安装路径     rpm -ql openssl.x86.rpm

     测试安装            rpm -ivh --test openssl.x86.rpm

     查询安装时间     rpm -qpi openssl.x86.rpm

     查询所属包        rpm -qf /usr/lib/libssl.so.6

8:实现开机自动挂载光盘。

     编辑fstab文件    vi /etc/fstab

     写入挂载            /dev/cdrom    /mnt     iso9660    defaults     0 0

9:查看系统是否安装reids软件。

     rpm -qa | grep reids  

 

posted @ 2020-06-15 15:40  尚小肆  阅读(314)  评论(0)    收藏  举报