美文网首页
第五周技术作业

第五周技术作业

作者: 神牧 | 来源:发表于2020-07-16 21:39 被阅读0次

1、查找/etc目录下大于1M且类型为普通文件的所有文件

[root@centos7 ~]# find /etc -size +1M -a -type f -exec ls -lh {} \;
-r--r--r--. 1 root root 8.0M May  9 17:35 /etc/udev/hwdb.bin
-rw-r--r--. 1 root root 1.4M May  9 17:32 /etc/selinux/targeted/contexts/files/file_contexts.bin
-rw-r--r--. 1 root root 3.7M May  9 17:32 /etc/selinux/targeted/policy/policy.31
-rw-------. 1 root root 3.7M May  9 17:32 /etc/selinux/targeted/active/policy.kern
-rw-------. 1 root root 3.7M May  9 17:32 /etc/selinux/targeted/active/policy.linked
-rw-r--r--. 1 root root 1.4M Apr 11  2018 /etc/brltty/zh-tw.ctb

2、打包/etc/目录下面所有conf结尾的文件,压缩包名称为当天的时间,并拷贝到/usr/local/src目录备份。

[root@centos7 ~]# tar -zcvpf /usr/local/src/`date +"%F_%T"`.tgz /etc/*conf

3、利用sed 取出ifconfig命令中本机的IPv4地址

[root@centos7 ~]# ifconfig ens33|sed -n -r '2s/(^[^0-9]+)([0-9.]+)( .*$)/\2/p'
192.168.58.131

4、删除/etc/fstab文件中所有以#开头,后面至少跟一个空白字符的行的行首的#和空白字符

[root@centos7 ~]# cp /etc/fstab /data/
[root@centos7 ~]# sed -i -r 's/^#[[:space:]]+(.*)/\1/p' /data/fstab
[root@centos7 ~]# cat /data/fstab

#
/etc/fstab
/etc/fstab
Created by anaconda on Sat May  9 17:22:35 2020
Created by anaconda on Sat May  9 17:22:35 2020
#
Accessible filesystems, by reference, are maintained under '/dev/disk'
Accessible filesystems, by reference, are maintained under '/dev/disk'
See man pages fstab(5), findfs(8), mount(8) and/or blkid(8) for more info
See man pages fstab(5), findfs(8), mount(8) and/or blkid(8) for more info
#
UUID=851c4aea-457e-4591-8226-b7cc938a7864 /                       xfs     defaults        0 0
UUID=a2943667-4cd5-4058-a0f4-2552dc106b35 /boot                   xfs     defaults        0 0
UUID=817c0830-1a6b-4345-89d2-2567e8fbd37d /data                   xfs     defaults        0 0
UUID=ed947da9-28d8-4361-bf8a-ccfa7b361ab6 swap                    swap    defaults        0 0

5、处理/etc/fstab路径,使用sed命令取出其目录名和基名

[root@centos7 ~]# echo /etc/fstab |sed -n -r 's@(^.*/)([^/]+)/?@\1@p'  //取目录名
/etc/
[root@centos7 ~]# echo /etc/fstab |sed -n -r 's@(^.*/)([^/]+)/?@\2@p'  //取基名
fstab

相关文章

  • 第五周技术作业

    1、查找/etc目录下大于1M且类型为普通文件的所有文件 2、打包/etc/目录下面所有conf结尾的文件,压缩包...

  • 正念冥想--知行家11.0精力管理.2践行之五

    212班11.0践行第五周作业安排(2021.9.18~9.24) 第五周主题:正念冥想 作业:1.结合平时的学习...

  • 20210919冥想作业

    群公告 212班11.0践行第五周作业安排(2021.9.18~9.24) 第五周主题:正念冥想 作业:1.结合平...

  • 2018-08-04

    王若松第五周词语作业

  • 135

    20170930,第五周周六。 国庆数学作业。 国庆节物理作业。 本周物理测...

  • 第五周假期生活

    时间过得真快,已经是假期的第五周啦。第五周里我完成的作业是。数学作业完成啦!数学暑假作业也完成啦。语文...

  • 129

    20170925,第五周周一。 语文周末作业完成情况。 数学周考情况 英语...

  • 效能复盘践行(五)掌握未来两周的固定日程--五色周表的运用

    212班10.0践行第五周作业安排(2020.5.29~6.4) 第五周主题:掌握未来两周的固定日程--五色周表的...

  • 假期第五周

    这个第五周呀,我干了很多事情,练字、弹古筝、洗碗、游泳、数学作业、听写、还有我的第五周总结...

  • 2020-02-09

    《自私的基因》第五周 2.3—2.9 精读 第五、六、七章 作业提交格式: 读书总结《_____________...

网友评论

      本文标题:第五周技术作业

      本文链接:https://www.haomeiwen.com/subject/etbphktx.html