<<<第一单元练习题>>>

  1. student用户登陆系统图形界面

Linux1-4单元练习_Linux

2.打开一个bash

3.修改student的密码,把密码更新成"T3st1ngtlme"(主机字母和数字)

Linux1-4单元练习_关键字_02

4.显示当前系统时间

5.显示当前系统时间,显示格式为:"小时:分钟: AM/PM"AM/PM为上下午标识)

Linux1-4单元练习_练习_03

6.显示“/usr/bin/clean-binary-files”的文件类型

7.统计“/usr/bin/clean-binary-files”的文件大小

8.用快捷方式在shell中调用已经执行过的第4条命令

9.用快捷方式执行最近一条含有"date"关键字的命令

Linux1-4单元练习_关键字_04


 <<<第二单元练习题>>>

  1. 用命令和正则表达式按照要求建立文件

*)用一条命令建立12个文件WESTOS_classX_linuxY(X的数值范围为1-2,Y的数值范围为1-6)

*)这些文件都包含在root用户桌面的study目录中

*)用一条命令建立8个文件redhat_versionX(x的范围为1-8)

*)redhat_virsionX这些文件都包含在/mnt目录中的VERSION中

 

[root@localhost Desktop]# mkdir study       //新建study目录

[root@localhost Desktop]# cd study/        

[root@localhost study]# touchWESTOS_class{1,2}_linux{1..6}     //新建文件

[root@localhost /]# cd /mnt            

[root@localhost mnt]# mkdir VERSION     //新建目录

[root@localhost mnt]# ls

filet VERSION  westos

[root@localhost mnt]# cd VERSION/

[root@localhost VERSION]# touch redhat_virsion{1..8}        //新建文件

Linux1-4单元练习_关键字_05

2.管理刚才信建立的文件要求如下

*)用一条命令把redhat_versionX中的带有奇数的文件复制到桌面的SINGLE中

*)用一条命令把redhat_versionX中的带偶数数的文件复制到/DOUBLE中

*)用一条命令把WESTOS_classX_linuxY中class1的文件一动到当前用户桌面的CLASS1中

*)用一条命令把WESTOS_classX_linuxY中class2的文件一动到当前用户桌面的CLASS2中

 

[root@localhost Desktop]# cp/mnt/VERSION/redhat_virsion{1,3,5,7} SINGLE        //复制文件到指定位置

[root@localhost Desktop]# cd SINGLE/

[root@localhost SINGLE]# ls                                     //查看当前目录

redhat_virsion1 redhat_virsion3 redhat_virsion5  redhat_virsion7

 

[root@localhost Desktop]# mkdir DOUBLE                          //新建目录

[root@localhost Desktop]# mkdir CLASS1

[root@localhost Desktop]# mkdir CLASS2

[root@localhost Desktop]# ls

09.20   CLASS1  DOUBLE    hello.mp3~  study   westos~

09.20~ CLASS2  hello.mp3  SINGLE     westos  word

[root@localhost Desktop]# cp/mnt/VERSION/redhat_virsion{2,4,6,8} DOUBLE        //复制文件

[root@localhost Desktop]# cd DOUBLE/

[root@localhost DOUBLE]# ls

redhat_virsion2 redhat_virsion4 redhat_virsion6  redhat_virsion8

[root@localhost DOUBLE]# cd .

[root@localhost DOUBLE]# cd ..

[root@localhost Desktop]# mv/root/Desktop/study/WESTOS_class1_linux* CLASS1/       //移动文件

[root@localhost Desktop]# cd CLASS1/

[root@localhost CLASS1]# ls

WESTOS_class1_linux1 WESTOS_class1_linux3 WESTOS_class1_linux5

WESTOS_class1_linux2 WESTOS_class1_linux4 WESTOS_class1_linux6

[root@localhost CLASS1]# cd ../

[root@localhost Desktop]# mv/root/Desktop/study/WESTOS_class2_linux* CLASS2/       //移动文件

Linux1-4单元练习_关键字_06

3.备份/etc目录中所有带有名字带有数字并且以.conf结尾的文件到桌面上的confdir中

 

[root@localhost Desktop]# mkdir confdir             //新建目录

[root@localhost Desktop]# cp/etc/*[[:digit:]]*.conf  confdir       //备份文件

[root@localhost Desktop]# cd confdir

[root@localhost confdir]# ls

e2fsck.conf  krb5.conf  mke2fs.conf pbm2ppa.conf  pnm2ppa.conf

 

5.删掉刚才建立或者备份的所有文件

Linux1-4单元练习_练习_07

[root@localhost Desktop]# ls

09.20  CLASS1  confdir  hello.mp3  SINGLE  westos   word

09.20~ CLASS2  DOUBLE   hello.mp3~ study   westos~

[root@localhost Desktop]# rm -fr CLASS* DOUBLE/SINGLE/ study/              //删除目录

[root@localhost Desktop]# ls

09.20 09.20~  confdir  hello.mp3 hello.mp3~  westos  westos~ word

[root@localhost Desktop]# rm -fr confdir/ mnt/VERSION/

[root@localhost Desktop]# ls

09.20 09.20~  hello.mp3  hello.mp3~ westos  westos~  word

[root@localhost Desktop]# cd /mnt

[root@localhost mnt]# ls

filet VERSION  westos

[root@localhost mnt]# rm -fr VERSION/

[root@localhost mnt]# ls

filet  westos

[root@localhost mnt]#

 

 

<<<第四单元练习>>>

1.在student用户下执行find/etc -name passwd 命令,并管理其输出要求如下:

 

        * 显示所有正确输出,屏蔽错误输出

        * 保存正确数出到/mnt/find.out,错误数出到/mnt/find.err中

        * 建立/mnt/find.all文件,并且保存所有输出到此文件中

        * 再次保存所有输出到/mnt/find.all中,并且保持源文件内容 

        * 屏蔽此命令的所有输出

        * 显示此命令的所有输出并保存输出到桌面上的任意文件中

        * 保存正确输出到/mnt/find.out.1中,屏蔽错误输出

Linux1-4单元练习_练习_08

Linux1-4单元练习_关键字_09

 

2.处理文件在文件/usr/share/mime/packages/freedesktop.org.xml要求如下:

 

    * 找到此文件中包含ich的行,并保存这些行到/root/lines中

    * 用vim替换掉/root/lines中的空格,但要保持文件中原有的内容