Linux1-4單元練習

         <<<第一單元練習題>>>

  1. student用戶登陸系統圖形界面

wKioL1fokdWyHICOAAEqpLkcdyY598.jpg-wh_50

2.打開一個bash

3.修改student的密碼,把密碼更新成"T3st1ngtlme"(主機字母和數字)

wKiom1fokfSgrcpPAAKZEZhmFtE243.jpg-wh_50

4.顯示當前系統時間

5.顯示當前系統時間,顯示格式爲:"小時:分鐘: AM/PM"AM/PM爲上下午標識)

wKioL1fokg-yvPjOAAGbMOW6qig978.jpg-wh_50

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

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

8.用快捷方式在shell中調用已經執行過的第4條命令

9.用快捷方式執行最近一條含有"date"關鍵字的命令

wKiom1fokkfhGVDyAALpb_pNBdw806.jpg-wh_50


 <<<第二單元練習題>>>

  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}        //新建文件

wKioL1fokp7CPPf8AAO2FwILz8w277.jpg-wh_50

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/       //移動文件

wKiom1fokrDja09PAARVdB-1mGI723.jpg-wh_50

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.刪掉剛纔建立或者備份的所有文件

wKioL1fokr2gq97cAAIPkjCMCOM634.jpg-wh_50

[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中,屏蔽錯誤輸出

wKiom1fokzHRFf5PAANJIIxt_U8891.jpg-wh_50

wKiom1fokz-SevhEAALQFz6SeVw849.jpg-wh_50

 

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

 

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

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

 


發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章