第二次作业
Posted
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了第二次作业相关的知识,希望对你有一定的参考价值。
####用命令和正则表达式建立文件####
用一条命令建立12个文件WESTOS_classX_linuxY(X的数值范围为1-2,Y的数值范围为1-6)
[[email protected] Desktop]$ touch WESTOS_class{1..2}_linux{1..6}
这些文件都包含在root用户桌面的study目录中
[[email protected] Desktop]# mkdir study/ ####在桌面上建立目录study####
[[email protected] Desktop]# ls ####显示桌面内容####
study
[[email protected] Desktop]# mv WESTOS_class{1..2}_liunx{1..6} /root/Desktop/study/ ####将制定文件WESTOS_class{1..2}_liunx{1..6}移到目录/root/Desktop/study/中####
[[email protected] Desktop]# ls /root/Desktop/study/ ####显示目录/root/Desktop/study/中内容####
WESTOS_class1_linux1 WESTOS_class1_linux5 WESTOS_class2_linux3
WESTOS_class1_linux2 WESTOS_class1_linux6 WESTOS_class2_linux4
WESTOS_class1_linux3 WESTOS_class2_linux1 WESTOS_class2_linux5
WESTOS_class1_linux4 WESTOS_class2_linux2 WESTOS_class2_linux6
[[email protected] Desktop]# touch reshat_version{1..8}
{[email protected] Desktop]# ls
redhat_version1 redhat_version3 redhat_version5 redhat_version7 study
redhat_version2 redhat_version4 redhat_version6 redhat_version8
[[email protected] Desktop]# mkdir /mnt/VERSION/
[[email protected] Desktop]# ls /mnt/
VERSION
[[email protected] Desktop]# mv reshat_version{1..8} /mnt/VERSION/
[[email protected] Desktop]# ls /mnt/VERSION/
redhat_version1 redhat_version3 redhat_version5 redhat_version7
redhat_version2 redhat_version4 redhat_version6 redhat_version8
\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\
####管理文件####
[[email protected] Desktop]# mkdir SINGLE/
[[email protected] Desktop]# ls
SINGLE study
[[email protected] Desktop]# cp /mnt/VERSION/redhat_version{1,3,5,7} /root/Desktop/SINGLE/
####把文件/mnt/VERSION/redhat_version{1,3,5,7}复制到目录/root/Desktop/SINGLE/中####
[[email protected] Desktop]# ls SINGLE/
redha_version1 redhat_version3 redhat_version5 redhat_version7
[[email protected] Desktop]# mkdir /DOUBLE/
[[email protected] Desktop]# ls /
bin dev etc lib media opt root sbin sys usr
boot DOUBLE home lib64 mnt proc run srv tmp var
[[email protected] Desktop]# cp /mnt/VERSION/redhat_version{2,4,6,8} /DOUBLE/
[[email protected] Desktop]# ls /DOUBLE/
redhat_version2 redhat_version4 redhat_version6 redhat_version8
[[email protected] Desktop]# mkdir CLASS1/
[[email protected] Desktop]# ls
CLASS1 SINGLE study
[[email protected] Desktop]# mv study/WESTOS_class1_linux{1..6} CLASS1/
[[email protected] Desktop]# ls CLASS2/
WESTOS_class1_linux1 WESTOS_class1_linux3 WESTOS_class1_linux5
WESTOS_class1_linux2 WESTOS_class1_linux4 WESTOS_class1_linux6
[[email protected] Desktop]# ls study
WESTOS_class2_linux1 WESTOS_class2_linux3 WESTOS_class2_linux5
WESTOS_class2_linux2 WESTOS_class2_linux4 WESTOS_class2_linux6
[[email protected] Desktop]# mksir CLASS2/
[[email protected] Desktop]# ls
CLASS1 CLASS2 SINGLE study
[[email protected] Desktop]# mv study/WESTOS_class2_linux{1..6} CLASS2/
[[email protected] Desktop]# ls CLASS2/
WESTOS_class2_linux1 WESTOS_class2_linux3 WESTOS_class2_linux5
WESTOS_class2_linux2 WESTOS_class2_linux4 WESTOS_class2_linux6
\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\
####备份以.conf结尾的文件并删除####
[[email protected] Desktop]# mkdir condir/
[[email protected] Desktop]# ls
CLASS1 CLASS2 condir SINGLE study
[[email protected] Desktop]# cp /etc/*.conf condir/
[[email protected] Desktop]# ls condir/
asound.conf idmapd.conf mtools.conf rsyslog.conf
brltty.conf ipsec.conf nfsmount.conf sestatus.conf
chrony.conf kdump.conf nsswitch.conf sos.conf
coloed.conf krb5.conf numad.conf sudo.conf
dnsmasq.conf ksmtuned.conf oddjobd.conf sudo-ldap.conf
dracut.conf ls.so.conf ovirt-guest-agent.conf sysctl.conf
e2fsck.conf libaudit.conf pbm2ppa.conf updatedb.conf
fprintd.conf libuser.conf pnm2ppa.conf usb_modeswitch.conf
fuse.conf locale.conf radvd.conf vconsole.conf
grub.conf logrotate.conf request-key.conf wvdial.conf
hba.conf man_db.conf resolv.conf yum.conf
host.conf mke2fs.conf rsyncd.conf
[[email protected] Desktop]# rm -r -f condir/ ####删除目录condir/####
[[email protected] Desktop]# ls
CLASS1 CLASS2 SINGLE study
以上是关于第二次作业的主要内容,如果未能解决你的问题,请参考以下文章