码迷,mamicode.com
首页 > 其他好文 > 详细

练习题(1)

时间:2019-08-03 23:40:54      阅读:242      评论:0      收藏:0      [点我收藏+]

标签:pam   nsswitch   less   cal   bashrc   switch   ane   inf   multipath   

┌┌╔,┌╔╔┌╔,.┌ ╔;ü▄MM?????????????██M▄▄?┌ ╔╔?M???????????????????????????█M▄_. ╔?M???????????????????????????????????█M?┌ │p?????????????????MMMMMMMM?????????????????M?. ╔($????????????M???`└` ``╚ü??M??????????????; ┌(M??????????M?ü" `??M????????????. ╔$???????????ü‘ └╚?M?????????%, ($?????????ü└ └?M??ü▓█████? ┌{??????????` ╚?ü████████?, ??????????ü‘ └{▓██████??? ($????????ü \ü▓??▓ü?éé ╔{????????? (üü?éééééM? ($???????é` │{üéééé?é?ù ╢????????ü [üéé????é} │{????????] ║$é?????éK │?????????[ ║$é??????} └?????????ü (????????} ?$???????k, ┌q????????ü ║?????????ù (?????????) (M????????\ ║$????????ü └?????????█? ║M?????????‘ ╚???????????, ┌(M?????????` ╚????????????, │M??????????‘ (M?????????M?╔ ╔jM█??????????` ╚????????????M?╔ ╔j▄?????██?????‘ │?????????????M▄?,. ┌╔j▄M█???????????éo ╚?M???????????????MMM▄▄???▄MMM?????????????????a └(?M???????????????????????????????????????` └^????????????????????????????????M??‘ `╚??WM??????????????????M???`‘ `└└????????????```

^[ ^ascii ^art ^generator ^]

1、显?/var?录下所有以l开头,以?个?写字?结尾,且中间出现?少?位数的?件或?录
技术图片

2、显?/etc?录下以任意?位数字开头,且以?数字结尾的?件或?录

技术图片

3、显?/etc/?录下以?字?开头,后?跟了?个字?及其它任意长度任意字符的?件或?录

技术图片

4、显?/etc/?录下所有以rc开头,并后?是0-6之间的数字,其它为任意字符的?件或?录

[root@c7e-uscwifi ~]#ls /etc/rc[0-6]* -d
/etc/rc0.d /etc/rc2.d /etc/rc4.d /etc/rc6.d
/etc/rc1.d /etc/rc3.d /etc/rc5.d
[root@c7e-uscwifi ~]#

5、显?/etc?录下,所有以.d结尾的?件或?录

[root@c7e-uscwifi ~]#ls /etc/*.d -d
/etc/auto.master.d /etc/popt.d
/etc/bash_completion.d /etc/prelink.conf.d
/etc/binfmt.d /etc/profile.d
/etc/cgconfig.d /etc/rc.d
/etc/chkconfig.d /etc/rc0.d
/etc/cron.d /etc/rc1.d
/etc/depmod.d /etc/rc2.d
/etc/dnsmasq.d /etc/rc3.d
/etc/dracut.conf.d /etc/rc4.d
/etc/exports.d /etc/rc5.d
/etc/gdbinit.d /etc/rc6.d
/etc/grub.d /etc/request-key.d
/etc/init.d /etc/rsyslog.d
/etc/ipsec.d /etc/rwtab.d
/etc/krb5.conf.d /etc/sane.d
/etc/ld.so.conf.d /etc/setuptool.d
/etc/libibverbs.d /etc/statetab.d
/etc/logrotate.d /etc/sudoers.d
/etc/modprobe.d /etc/sysctl.d
/etc/modules-load.d /etc/tmpfiles.d
/etc/my.cnf.d /etc/xinetd.d
/etc/oddjobd.conf.d /etc/yum.repos.d
/etc/pam.d
[root@c7e-uscwifi ~]#

6、显?/etc?录下,所有.conf结尾,且以m,n,r,p开头的?件或?录

[root@c7e-uscwifi ~]#ls /etc/[mnrp].conf -d^C
[root@c7e-uscwifi ~]#
[root@c7e-uscwifi ~]#
[root@c7e-uscwifi ~]#
[root@c7e-uscwifi ~]#ls /etc/[mnrp]
.conf
/etc/man_db.conf /etc/nsswitch.conf /etc/radvd.conf
/etc/mke2fs.conf /etc/ntp.conf /etc/request-key.conf
/etc/mtools.conf /etc/numad.conf /etc/resolv.conf
/etc/nfs.conf /etc/pbm2ppa.conf /etc/rsyncd.conf
/etc/nfsmount.conf /etc/pnm2ppa.conf /etc/rsyslog.conf
[root@c7e-uscwifi ~]#

7、只显?/root下的隐藏?件和?录

[root@c7e-uscwifi ~]#ls /root/.[^.] -d^C
[root@c7e-uscwifi ~]#
[root@c7e-uscwifi ~]#
[root@c7e-uscwifi ~]#ls /root/.[^.]
-d
/root/.ICEauthority /root/.config /root/.swp
/root/.bash_history /root/.cshrc /root/.tcshrc
/root/.bash_logout /root/.dbus /root/.viminfo
/root/.bash_profile /root/.esd_auth /root/.viminfo.tmp
/root/.bashrc /root/.lesshst
/root/.cache /root/.local
[root@c7e-uscwifi ~]#

8、只显?/etc下的?隐藏?录

[root@c7e-uscwifi ~]#ls /etc/[^.]/ -d^C
[root@c7e-uscwifi ~]#
[root@c7e-uscwifi ~]#
[root@c7e-uscwifi ~]#ls /etc/[^.]
/ -d
/etc/NetworkManager/ /etc/modprobe.d/
/etc/PackageKit/ /etc/modules-load.d/
/etc/UPower/ /etc/multipath/
/etc/X11/ /etc/my.cnf.d/
/etc/abrt/ /etc/ntp/
/etc/alsa/ /etc/oddjob/
/etc/alternatives/ /etc/oddjobd.conf.d/
/etc/audisp/ /etc/openldap/
/etc/audit/ /etc/opt/
/etc/auto.master.d/ /etc/pam.d/
/etc/avahi/ /etc/pkcs11/

复制?件和?录
1、每天将/etc/?录下所有?件,备份到/data独?的??录下,并要求??录格式为 backupYYYY-mm-dd,备份过程 可见

[root@c7e-uscwifi ~]#\cp -rvf /etc/ /data/backupdate +%F | head ^C
[root@c7e-uscwifi ~]#
[root@: command not found...
[root@c7e-uscwifi ~]#\cp -rvf /etc/ /data/backupdate +%F | head
‘/etc/fstab‘ -> ‘/data/backup2019-07-25/etc/fstab‘
‘/etc/crypttab‘ -> ‘/data/backup2019-07-25/etc/crypttab‘
removed ‘/data/backup2019-07-25/etc/mtab‘
‘/etc/mtab‘ -> ‘/data/backup2019-07-25/etc/mtab‘
‘/etc/resolv.conf‘ -> ‘/data/backup2019-07-25/etc/resolv.conf‘
removed ‘/data/backup2019-07-25/etc/fonts/conf.d/65-0-lohit-bengali.conf‘
‘/etc/fonts/conf.d/65-0-lohit-bengali.conf‘ -> ‘/data/backup2019-07-25/etc/fonts/conf.d/65-0-lohit-bengali.conf‘
removed ‘/data/backup2019-07-25/etc/fonts/conf.d/20-unhint-small-dejavu-sans.conf‘
‘/etc/fonts/conf.d/20-unhint-small-dejavu-sans.conf‘ -> ‘/data/backup2019-07-25/etc/fonts/conf.d/20-unhint-small-dejavu-sans.conf‘
removed ‘/data/backup2019-07-25/etc/fonts/conf.d/57-dejavu-sans.conf‘
[root@c7e-uscwifi ~]#

2、创建/data/rootdir?录,并复制/root下所有?件到该?录内,要求保留原有权限 ?录操作

cp -rp /root /data/rootdir

(1) 如何创建/testdir/dir1/x, /testdir/dir1/y, /testdir/dir1/x/a, /testdir/dir1/x/b, /testdir/dir1/y/a, /testdir/dir1/y/b

[root@c7e-uscwifi ~]#tree /testdir/ -C
/testdir/
-- dir1<br/>|-- x<br/>| |-- a<br/>|-- b
-- y<br/>|-- a<br/>-- b

7 directories, 0 files
[root@c7e-uscwifi ~]#mkdir -p /testdir/dir1/{x,y}/{a,b}

(2) 如何创建/testdir/dir2/x, /testdir/dir2/y, /testdir/dir2/x/a,/testdir/dir2/x/b

[root@c7e-uscwifi ~]#mkdir -p /testdir/dir2/{x/{a,b},y}
[root@c7e-uscwifi ~]#tree /testdir/ -C
/testdir/
-- dir2<br/>|-- x<br/>| |-- a<br/>|-- b
`-- y

5 directories, 0 files
[root@c7e-uscwifi ~]#

(3) 如何创建/testdir/dir3, /testdir/dir4, /testdir/dir5, /testdir/dir5/dir6, /testdir/dir5/dir7

[root@c7e-uscwifi ~]#\rm -fr /testdir
[root@c7e-uscwifi ~]#mkdir -p /testdir/dir{3,4,5/dir{6,7}}
[root@c7e-uscwifi ~]#tree /testdir/ -C
/testdir/
|-- dir3
|-- dir4
-- dir5<br/>|-- dir6<br/>-- dir7

5 directories, 0 files
[root@c7e-uscwifi ~]#

技术图片

练习题(1)

标签:pam   nsswitch   less   cal   bashrc   switch   ane   inf   multipath   

原文地址:https://blog.51cto.com/14451083/2426284

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!