老實說,在考完101準備102的這段時間中,
真的有點腦袋空空的感覺!哈
還好我原本就有個伙伴一起考,可以互相勉勵!
而你的來信,也剛好可以讓我教學相長的過程中,
加強了我一些應考的情緒和思維!
更讓我高興的是,透過網路,
我多認識了一個對unix-like OS有興趣的同好,
能互相分享學習彼此的經驗,
這是一個很好而且難得的人生經驗,不是嗎?Leo
你這次來信,裡頭提到的問題!
你「猜」的答案,有對有錯。
我整理了一下,然後對部份題目提出我的見解。
Leo參考看看吧!
Q 1
How can you describe the function of the following commands? foo < bar | foobar (單選)
a. The command foobar gets its input from the command bar
b. The command foo redirects its output to foobar
c. The command bar writes its output into the file foo
d. The command foo gets its input from the file bar and if its exitcode is not 0, the command foobar will be executed
e. The file foo is written by the command "bar | foobar"
Ans: b
之前我說,很簡單的解題方法是,
看到pipe(|),那它的左右都是指令(command),
看到大於(>)小於(<)那後面就接檔案(file)吧。
但這個題目,剛好不適用我的方法!Shit~
我想,也許我的方法,還要加上類似先乘除後加減的法則吧?
好!不廢話...
指令丢給shell處理的方式,
應該說是像直譯式的程式執行器吧。
所以它是從頭一個一個認,
辨識出來後一個一個解譯執行!
foo < bar | foobar
是說,foo命令會先把小於(<)之後接的檔案bar處理掉,
然後把結果利用pipe(|)再丢給foobar命令處理。
但很機車的是,答案選項沒有完整敍述的選項可選!
如果有以下這一句:
The command foo gets its input from the file bar and redirects its output to foobar.
就一定選它!
所以只能挑比較相近的選項了,b。
Q 2
Which toplevel directory contains the spool and log directories? Enter the whole path
Ans: /var
這題Leo答案沒錯!
Q 3
You want to connect a X11-Terminal to your Server. But everytime you try
to connect, your terminal screen keeps black. What files on the server
would you edit to solve the problem? (複選)
a. /etc/X11/XF86Config
b. /etc/X11/xdm/x-terminals
c. /etc/X11/xdm/xdm-config
d. /etc/X11/xdm/Xwilling
e. /etc/X11/xdm/Xaccess
Ans: a c
這題的答案應該是a c 。
X-server的相關設定只能用背的了!
我對X-window不是很行,而我所知道,講X的書和資料也很少有很完整的。
Q 4
What set of scripts is included in a debian packet? (單選)
a. install,configure,deinstall,deconfigure
b. preinst,postinst,prerm,postrm
c. install,configure,libinst,libconf
d. checklib,checkdep,checkfree,checkspace
Ans: b
這題有點艱澀,我也是找google好久才找到。
用背的吧,看到全是p開頭的字就是了。
Q 5
What is the best way to get a running foreground-job in the background? (單選)
a. Kill the job using Ctrl-C and restart it in the background using &
b. Suspend the job using Ctrl-Z and restart it in the background using &
c. Suspend the job using Ctrl-Z and restart it in the background using bg
d. Start another shell from another console (or xterm) and send the job a STBG-signal
e. Simply press Ctrl-&
Ans: c
把己經在前景執行的程式,暫停再丢入背景執行的方法。
先用Ctrl+Z,你會得到一個 stopped 的 job ID(用中括號包住的號碼)。
再以bg指令把這個job ID丢到背景執行!
Q 6
Consider a unmounted partition /dev/hdc7 should be mounted on
/usr/local.
The following entry in /etc/fstab exists
/dev/hdc7 /usr/local ext2 defaults 1 2
Which command could you use to mount the filesystem? (複選)
a. mount -l /dev/hdc7
b. mount /dev/hdc7
c. mount /dev/hdc7 /usr/local
d. mount /usr/local
e. mount -V /usr/local
Ans: c d
其實現在的linux版本,很多指令己經做了不少防呆措施。
像mount指令,你若是用選項b也是可以的,只要你在fstab定義好。
但正規的符合LPIC的解答只能選c和d。
直接給掛載點(目錄路徑),而不能給裝置。要注意!
像是這類的題目,我們也很難去爭論說,
明明這樣可以,為什麼解答卻不對!
只能說,linux還是有標準的,
你用了不符標準的東西,得出不正確的結果,
那並不能把標準的定義給否定掉!就這樣!
Q 7
In the directory /home/foo exists a file named bar which is
a symbolic link to the file foobar in the same directory, created with the command
ln -s foobar bar
If you would copy the link to /tmp using the command
cp -d /home/foo/bar /tmp
what would happen? (單選)
a. The destination /tmp/bar is a symbolic link to /tmp/foobar
b. The destination /tmp/bar is a symbolic link to /home/foo/foobar
c. The destination /tmp/bar is a regular file with the same content as /home/foo/foobar
d. The destination /tmp/bar is a hardlink using the same inode as /home/foo/foobar
e. The destination /tmp/bar is a hardlink using the same inode as /home/foo/bar
Ans: a
嘿嘿!
這題有陷阱,記得我說過,
用ln -s時,要小心用絶對路徑還是相對路徑嗎?
題目是用相對路徑建soft link,你有注意到嗎?
本來我也答錯,以為是b。
因為我們都被cp -p 騙了,以為它複製了絶對路徑的link檔。
錯了!/home/foo/bar是一個相對路徑的link檔,
因此複製過去/tmp,它還是一個相對路徑的link檔,
指向foobar,在/tmp下的foobar。
在 2007/9/5,y_cdlu@tsmc.com
>
> Dear 國弘兄:
>
> 又有幾題了!不好意思!
> 考101的日子就訂在9月中前後1,2天
> 目前也是一直在衝考古題
> 和導正自己的一些觀念,希望能順利拿到101
>
> 我聽完你 ln 的解釋,我有比較清楚了.
> 當然我也是覺得soft link是比較常用也較好理解的
>
> 想問一下regular file,應該如何詮釋呢?搞不懂!!
>
> soft link 用相對路徑與絕對路徑的考題我有特別注意 ^^
> 感謝你的提醒
>
> How can you describe the function of the following commands? foo < bar |
> foobar (單選)
> a. The command foobar gets its input from the command bar
> b. The command foo redirects its output to foobar
> c. The command bar writes its output into the file foo
> d. The command foo gets its input from the file bar and if its exitcode
> is not 0, the command foobar will be executed
> e. The file foo is written by the command "bar | foobar"
>
> Ans: c (我猜的)
>
> Which toplevel directory contains the spool and log directories? Enter
> the whole path
> Ans: /var (我猜的)
>
> You want to connect a X11-Terminal to your Server. But everytime you try
> to connect, your terminal screen keeps black. What files on the server
> would you edit to solve the problem? (複選)
> a. /etc/X11/XF86Config
> b. /etc/X11/xdm/x-terminals
> c. /etc/X11/xdm/xdm-config
> d. /etc/X11/xdm/Xwilling
> e. /etc/X11/xdm/Xaccess
>
> Ans: 不知道怎麼猜了
>
> What set of scripts is included in a debian packet? (單選)
> a. install,configure,deinstall,deconfigure
> b. preinst,postinst,prerm,postrm
> c. install,configure,libinst,libconf
> d. checklib,checkdep,checkfree,checkspace
>
> Ans: a (我猜的)
>
> What is the best way to get a running foreground-job in the background? (單選)
> a. Kill the job using Ctrl-C and restart it in the background using &
> b. Suspend the job using Ctrl-Z and restart it in the background using &
> c. Suspend the job using Ctrl-Z and restart it in the background using bg
> d. Start another shell from another console (or xterm) and send the job a STBG-signal
> e. Simply press Ctrl-&
>
> Ans: c (我猜的)
>
> Consider a unmounted partition /dev/hdc7 should be mounted on
> /usr/local.
> The following entry in /etc/fstab exists
> /dev/hdc7 /usr/local ext2 defaults 1 2
> Which command could you use to mount the filesystem? (複選)
> a. mount -l /dev/hdc7
> b. mount /dev/hdc7
> c. mount /dev/hdc7 /usr/local
> d. mount /usr/local
> e. mount -V /usr/local
>
> Ans: c . d (我猜的)
>
> In the directory /home/foo exists a file named bar which is
> a symbolic link to the file foobar in the same directory, created with the command
> ln -s foobar bar
> If you would copy the link to /tmp using the command
> cp -d /home/foo/bar /tmp
> what would happen? (單選)
> a. The destination /tmp/bar is a symbolic link to /tmp/foobar
> b. The destination /tmp/bar is a symbolic link to /home/foo/foobar
> c. The destination /tmp/bar is a regular file with the same content as /home/foo/foobar
> d. The destination /tmp/bar is a hardlink using the same inode as /home/foo/foobar
> e. The destination /tmp/bar is a hardlink using the same inode as /home/foo/bar
>
> Ans: b (我覺得)
>
>
>
> Leo Lu(Cheng-Da Lu 呂政達)
>
1 則留言:
感謝吳大的回答哦
對我幫助很多,我也是很開心能透過學習linux,而認識朋友!
這也是我最意想不到的收獲!
張貼留言