2019-03-18 第四周考试总结

1、已知文件/test.txt内容为:

test

Linux

oldboy

请给出输出中不包含oldboy的行的命令

方法一:grep -v  "oldboy" /test.txt

方法二:head -2 /test.txt

方法三:sed -n '1,2p' /test.txt


2、查找当前目录下30天以前创建的名为’oldboy.txt’文件的命令是?

find  ./ -type f -name 'oldboy.txt' -mtime+30


3、查找3天内修改过的文件名为‘oldboyedu.txt’的文件,并把它打包到/tmp目录下,请用一条命令实现

方法一:find ./ -type f -mtime -3 -name 'oldboyedu.txt' |xargs tar zvcf /tmp/oldboyedu.tar.gz

方法二:find ./ -type f –mtime -3 –name‘oldboyedu.txt’ –exec tar zcvf /tmp/oldboyedu.tar.gz {} \;


方法三:tar zcvf /tmp/oldboyedu.tar.gz  `find ./ -type f –mtime -3–name‘oldboyedu.txt'`

方法四:tar zcvf /tmp/oldboyedu.tar.gz  $(find ./ -type f –mtime -3 –name'oldboyedu.txt')

4、当我们刚部署了一台Centos7系统的服务器,想要通过ifconfig管理网卡,发现没有ifconfig命令,又不知道该命令属于哪个软件包,请按步骤写出安装ifconfig命令的操作步骤(ifconfig命令属于net-tools软件包)

第一步:yum provides ifconfig

第二部:yum install net-tools -y


5、请按要求写出操作命令

1)[endif]通过echo命令将1-10数字序列插入到/num.txt文件中,以空格分隔排成一行

echo {1..10} >/num.txt 


2)将上述/num.txt文件中数字序列按行输出,每行一个数字

方法一:echo -e {1..10}"\n"

方法二:cat num.txt |xargs -n1

方法三:xargs -n1

方法四:tr " " "\n" < num.txt

6、请解释以下报错信息分别代表什么含义?

command not found                                        命令找不到

cannot create directory ‘oldboy/’: Fileexists    不能创建oldboy目录,文件已存在

No such file or directory                                   没有这个文件或目录

no space left on device                                    当前磁盘没有剩余空间(磁盘满了)

cannot remove ‘/tmp/’: Is a directory                不能删除/tmp/ : 他是个目录

你可能感兴趣的:(2019-03-18 第四周考试总结)