1.題目:
Execute this command:
$ cd /sbin ; ls -li e2fsck fsck.ext2
a. What is the significance of the first field of the output?
b. Why is it identical for both listings?
c. Why are the file sizes identical?
執行過程:
[Niki@15:22:30 /]$ cd /sbin ; ls -li e2fsck fsck.ext2
4190254 -rwxr-xr-x 3 root root 1118940 2007-10-24 11:39 e2fsck
4190254 -rwxr-xr-x 3 root root 1118940 2007-10-24 11:39 fsck.ext2
答案:
[Niki@15:23:22 sbin]$ #a. the index of the file which put in the disk's inode
[Niki@15:35:21 sbin]$ #b.pointer to the same physical address
[Niki@15:36:17 sbin]$ #c. because they are same file
2.
題目: Execute the following command sequence and
explain the result at each step(this example assumes
that cp is not aliased to cp -i,which is a common default alias ):
$cd
$cp /etc/skel .
$cp -r /etc/skel .
$cp -rfv /etc/skel .
$cp -rfvp /etc/skel .
執行結果:
[Niki@15:46:55 ~]$ cd
[Niki@15:46:57 ~]$ cp /etc/skel .
cp: 略過 ‘/etc/skel’ 目錄
[Niki@15:47:14 ~]$ cp -r /etc/skel .
[Niki@15:47:29 ~]$ cp -rfv /etc/skel .
‘/etc/skel/.emacs’ -> ‘./skel/.emacs’
‘/etc/skel/.bashrc’ -> ‘./skel/.bashrc’
‘/etc/skel/.zshrc’ -> ‘./skel/.zshrc’
‘/etc/skel/.bash_profile’ -> ‘./skel/.bash_profile’
‘/etc/skel/.bash_logout’ -> ‘./skel/.bash_logout’
‘/etc/skel/.kde/Autostart/.directory’ -> ‘./skel/.kde/Autostart/.directory’
[Niki@15:49:02 ~]$ cp -rfvp /etc/skel .
‘/etc/skel/.emacs’ -> ‘./skel/.emacs’
‘/etc/skel/.bashrc’ -> ‘./skel/.bashrc’
‘/etc/skel/.zshrc’ -> ‘./skel/.zshrc’
‘/etc/skel/.bash_profile’ -> ‘./skel/.bash_profile’
‘/etc/skel/.bash_logout’ -> ‘./skel/.bash_logout’
‘/etc/skel/.kde/Autostart/.directory’ -> ‘./skel/.kde/Autostart/.directory’
答案:
[Niki@15:49:14 ~]$ #cd 根目錄
[Niki@15:49:42 ~]$ #cp /etc/skel . skip and no copy
[Niki@15:50:20 ~]$ #cp -r /etc/skel . copy all of data of the file
[Niki@15:51:07 ~]$ #cp -rfv /etc/skel . no ask and copy all of data of the file
[Niki@15:51:46 ~]$ #cp -rfvp /etc/skel . reserve the original file
3.題目:
Remove the directory created in the previous exercise,using rmdir and/or rm.
Which command can complete the task in a single step?
答案:
[Niki@16:04:52 ~]$ #use rm -f can force delete file and don't ask,
the"rm" use a single step ,the "rmdir" can only remove empty file
4.題目:
Explain when the wildcard {htm,html} might be useful.
執行過程:
[Niki@16:13:16 ~]$ touch a.htm
[Niki@16:13:30 ~]$ touch b.html
[Niki@16:13:38 ~]$ touch 1.htm
[Niki@16:13:45 ~]$ touch 2.html
[Niki@16:13:49 ~]$ ls *.{htm,html}
1.htm 1.html 2.html a.htm a.html b.html
答案:
[Niki@16:14:15 ~]$ We can quickly find the file name with htm and html
5. 題目:
Give an example of how the wildcard *.[Tt][Xx][Tt]
could be used with directory listings.
答案:
[Niki@16:20:55 ~]$ touch niki.TXT
[Niki@16:21:18 ~]$ touch niki1.txT
[Niki@16:21:34 ~]$ touch niki2.tXT
[Niki@16:21:43 ~]$ ls *.[Tt][Xx][Tt]
niki1.txT niki2.tXT niki.TXT word2.txt
6. 題目:
What can be said about filenames matched by the *.??? wildcard?
答案:
[Niki@16:22:06 ~]$ ls *.???
1.htm a.htm a.out niki1.txT niki2.tXT niki.TXT word2.txt