2007年12月22日 星期六

一份網路上的考古題 LPIC 102

這份考題是一位也有興趣考LPIC的朋友給的,
本來是要相互切磋,討論用的,
卻因為我前一陣子工作繁忙給忽略了。
真是對不起這位有心人!


102考題複習
000.Every kernel module should exactly fit the kernel for which it is
compiled. What command can you use to change the current working
directory to the directory where the modules for the running kernel are
stored? (單選)
a. cd /lib/modules/$(getkernelid)
b. cd /lib/modules/$(uname -r)
c. cd /lib/modules/$(uname -a)
d. cd $(uname --kerneldir)
e. cd $(uname --moduledir)
Ans: b (我猜的)
没錯!uname -r 很好用,
有時你會看到有的人是用倒斜線來進行命令代換,
像是你要查你現在OS所用到的模組,其相依性如何,就是記錄在 /lib/modules/`uname -r`/modules.dep 裡頭哦。

001.You can give options to the kernel (複選)
a. using the append-command in /etc/lilo.conf
b. using the options-command in /etc/lilo.conf
c. appending the options to the kernel name while using the bootmanager
d. using the chopt command while running the system
e. writing the desired options to /proc/kernel
Ans: a . c

002.What is the effect of the command init S ? (單選)
a. The system will be rebooted
b. The system will be shut down
c. The system will change into single user mode
d. The system will change into normal multi user mode
e. There is no runlevel S, runlevels are numbers
Ans: c (我猜的)
在我比較熟悉的RedHat版本中,runlevel 1和s或S,都是進到single單人模式。


003. Which command is used to show the contents of a printer queue?
(Enter just the command, no path and options)
Ans: lpq


004. You are printing with lpr. Which parameter do you use to select a
particular printer? (單選)
a. -p
b. -P
c. --printer
d. -q
e. -Q
Ans: a



005. What command offers you information about a standard Linux-tool?
(複選)
a. man
b. info
c. help
d. whatis
e. howto
Ans: a . b (我猜的)

不會用linux,找男人(man)就對了!
man這個指令,其實是用來看壓縮過後的檔案,
不信你去看/usr/share/man/man1裡頭的檔案,都是gz結尾,没錯吧。
別以為把他們解壓縮了,就是你用man看到的內容,man還藏了機關的。
想把man到的內容存下來慢慢看的話,可以用以下指令:
man bash | col -b > bash.man.txt
那個bash.man.txt,我相信才是你要用的資料檔案,
建議還是線上看啦,印出來的話,很浪費墨水和紙的。

還有info,它是比較複雜一點的使用查詢介面。比man強大,會用的話,也是有不少參考資訊。
而linux指令的使用說明,也可以在一個指令後給 (--help) 選項查。
但help也是一個指令,主要是提供bash內建指令的簡單說明。
如果你問我,那些指令是bash內建的指令?
哇哩咧!你直接打help指令看看吧!因為我一時也說不清...

至於那些非內建的指令,可以用whatis來查它的簡單使用說明。
真的很簡單!剛開始用linux的人,也許可以看看吧!
還有一個apropos指令。可以給字串當參數,讓它去找whatis的資料庫?
但使用時機,我就不太清楚了。

另外要補充的是:
man -f 等於是指令whatis
man -k 等於是指令apropos

所以以上選項,除了howto没有用以外,都是可以用來查詢linux指令用法。
我選a b c d


006. Which file is displayed directly after logging in on a text
console? (單選)
a. /etc/issue
b. /etc/login.txt
c. /etc/motd
d. /etc/messg
e. /etc/welcome
Ans: c

要登入時,會先看到/etc/issue這個檔案內容,轉換成的提示。
登入後,看到的就是/etc/motd了。
其他的選項...不管它。


007. Writing a shellscript you want to check if the file foobar exists
and is writable by the user who runs the script. Which of
the following test commands will check this? (單選)
a. test -e foobar
b. test -r foobar
c. test -b foobar
d. test -w foobar
e. test -f foobar
Ans: d

Man TEST
-b FILE FILE exists and is block special
-c FILE FILE exists and is character special
-d FILE FILE exists and is a directory
-e FILE FILE exists
-f FILE FILE exists and is a regular file
-g FILE FILE exists and is set-group-ID
-G FILE FILE exists and is owned by the effective group ID
-h FILE FILE exists and is a symbolic link (same as -L)
-k FILE FILE exists and has its sticky bit set
-L FILE FILE exists and is a symbolic link (same as -h)
-O FILE FILE exists and is owned by the effective user ID
-p FILE FILE exists and is a named pipe
-r FILE FILE exists and read permission is granted
-s FILE FILE exists and has a size greater than zero
-S FILE FILE exists and is a socket
-t FD file descriptor FD is opened on a terminal
-u FILE FILE exists and its set-user-ID bit is set
-w FILE FILE exists and write permission is granted
-x FILE FILE exists and execute (or search) permission is granted

008. Writing a shellscript you want to check if the file foobar exists
and is writable by the user who runs the script. Which of
the following test commands will check this? (單選)
a. test -e foobar
b. test -r foobar
c. test -b foobar
d. test -w foobar
e. test -f foobar
Ans: d (我猜的)

009. What command can you use to remove an existing group named foo? (單選)
a. rmgrp foo
b. delgrp foo
c. delgroup foo
d. remove --group=foo
e. groupdel foo

群組管理指令:
gpasswd
groupadd
groupdel
groupmod
groups
newgrp
chgrp

還有嗎?我再查查...
選 e


010. You want to change from old /etc/passwd format to the modern and
more save shadow password system. What command can you use for that
purpose? (單選)
a. mkshadow
b. shadow
c. sh_create
d. sh-create
e. pwconv
Ans: e (我猜的)

没錯!回復呢?用pwunconv

011. What command can be used to moitor the file /var/log/messages, to
see newly incoming messages? (單選)
a. tail -l /var/log/messages
b. tail -f /var/log/messages
c. tail -w /var/log/messages
d. cat /var/log/messages | tail -f
e. tail -10 /var/log/messages
Ans: a (我猜的)

這題要選b,這個指令若是管理linux的話,會很常用到。要背起來。

012. Enter the command (without path and options) to display information
about a given kernel module?
Ans: modinfo


013. Which file is used by modprobe to get the information, what kernel
module is needed by a particular other kernel module? (單選)
a. /etc/modules.dep
b. /etc/modules.conf
c. /lib/modules/$(uname -r)/modules.dep
d. /lib/modules/$(uname -r)/modules.conf
e. /lib/modules/$(uname -r)/modules.needed
Ans: c (我猜的)
這題在上面有提過了,選 c 没錯。
/etc/modules.conf則是設定開機時硬體需要載入的模組。


014. After compiling a new kernel on a PentiumII System, where will you
find the new kernel file? (單選)
a. /usr/src/linux
b. /usr/src/linux/kernel
c. /usr/src/linux/arch/i386/boot
d. /usr/src/linux/arch/i486/boot
e. /usr/src/linux/arch/i586/boot
Ans: c (我猜的)

015. What command can you use to read the kernel bootup messages? (Just
the command, no options)
Ans:

016. The command ____________ -r shows the release number of the
currently working kernel
Ans:

017. You have just loaded a new version of the kernel source and
installed it into /usr/src/kernelnew. In /usr/src/kernelold are the
sources of your old kernel. Before configuring the new kernel you want
to get as much configuration information as possible from the old kernel
to the new one. What file will you copy from kernelold to kernelnew to
archieve this?
a. Makefile
b. kernel.dat
c. kernel.conf
d. .config
e. .kernelconf
Ans:

018. Which file contains the main log of the system?
a. /var/mesg
b. /var/log
c. /var/log/mesg
d. /var/log/messages
e. /var/messages
Ans:d

019. How can you get informations about all manpages concerning a
command named foo?
a. apropos foo
b. whatis foo
c. man foo
d. list foo
e. which foo
Ans:

020. Which file is displayed directly after logging in on a text
console?
a. /etc/issue
b. /etc/login.txt
c. /etc/motd
d. /etc/messg
e. /etc/welcome
Ans:

021. You get a mail from user bart, in which he tells you, that he can't
execute a self written shell-script named foo. This script is placed in
the directory /home/bart and the user's current working directory is
/home/bart, too. The ls -l command shows the script and the user has
execute permission. What would probably be the reason of the problem?
a. A user may not execute scripts inside his home-directory
b. The PATH-variable don't includes the . entry
c. A normal user may not execute shellscripts anywhere
d. The enviroment-variable EXEC is not set
e. An error inside the script
Ans:

022. Which statement about the following line is true?
[ -x /usr/sbin/daemon ] && /usr/sbin/daemon
a. /usr/sbin/daemon will be executed if it exists and is executable
b. The daemon will be executed with it's own path as parameter
c. This is a recursive call to daemon
d. This isn't a valid command
Ans:

023. You have just loaded a new version of the kernel source and
installed it into /usr/src/kernelnew. In /usr/src/kernelold are the
sources of your old kernel. Before configuring the new kernel you want
to get as much configuration information as possible from the old kernel
to the new one.
What file will you copy from kernelold to kernelnew to archieve this?
a. Makefile
b. kernel.dat
c. kernel.conf
d. .config
e. .kernelconf
Ans:d (我猜的)

024. Which command will you use to control printers?
a. lpd
b. lpr
c. lpic
d. lpc
e. plp
Ans:d (我猜的)

025. What does the following entry from /etc/printcap means?
lp|lp1:\
:sd=/var/spool/lp:\
:rm=foo:\
:rp=bar:
a. This is a local Printer known as lp or lp1 with metric foo and
postscript filter bar.
b. This is a remote printer known as lp on the local machine and as lp1
on the remote machine.
c. This is a remote printer on host foo and there known as bar
d. This is a local printer which is accessable by the hosts foo and bar
e. This is a remote printer on host bar
Ans:c (我猜的)

026. The file _____________ is displayed by getty befor the login
message.
(Please enter full path and filename)
Ans: /etc/log/message (我猜的)

027. You have written a shellscript in /usr/local/bin/myscript. The
script is executable by all users. But every time when you start it, the
following error occurs: bash: myscript: No such file or directory. What
is likely to be the reason?
a. The /usr/local/bin directory is not in the PATH variable
b. You don't have read permission to myscript
c. Shellscripts are not binaries, so don't place them in a bin directory
d. You made a mistake (typo) in the #!/bin/bash line
e. You have to compile the script
Ans:b (我猜的)

028. The file /etc/syslog.conf contains the following line: *.crit
/var/log/warn
a. The syslog daemon reads its rules for all facilities with priority
"crit" or any higher priority out of the file /var/log/warn
b. All messages of all facilities with priority "crit" are written into
the file /var/log/warn
c. The file /var/log/warn contains a list of all errors which are
defined as critical
d. The syslog daemon reads its rules for all facilities with priority
"crit" out of the file /var/log/warn
e. All messages of all facilities with priority "crit" or any higher
priority are written into the file /var/log/warn
Ans: e

029. The file /etc/syslog.conf contains the following line: *.=crit
/var/log/warn
Ans: a (同上題)

030. Which criteria can be used in the logrotate configuration file to
determine when a logfile should be rotated? (複選)
a. hourly rotating
b. daily rotating
c. weekly rotating
d. monthly rotating
e. filesize
Ans:a.b.c.d (我猜的)

031. What elements may be used in a crontab file besides the scheduling
command? (複選)
a. Declaration of shell variables
b. Declaration of aliases
c. Declaration of functions
d. Declaration of a pre-exec script
e. Declaration of a post-exec script
Ans: b.c (我猜的)

032. You downloaded a file boot.img which contains the image of a
bootdisk. How can you transfer this file to a floppy disk so the disk is
bootable?
a. Mount the floppy and copy it with cp
b. Mount the floppy and copy it with rawrite
c. Use "restore boot.img > /dev/fd0"
d. Use "dd if=boot.img of=/dev/fd0"
e. Use "dd if=/dev/fd0 of=boot.img"
Ans:d (我猜的)

033. You want to set the system time, so you use the command "date
MMDDhhmm". All seems fine but after the next reboot the system time is
wrong again. What is the reason?
a. The date-command is called by an init-script which sets the wrong
time every time you boot linux
b. The date-command just sets the system time, not the cmos clock
c. Your cmos-clock runs to slow due to low battery status
d. You have to adjust the bogomips settings of your computer
Ans: b (我猜的)

034. Which service works usually on port 119 ?
a. nntp
b. http
c. pop3
d. snmp
e. imap
Ans: a

035. What is the dotted quad address of the localnet?
Ans: 192.168.1.0

036. Your network has a network address of 172.16.170.0/23. What are
valid host addresses in your network? (複選)
a. 172.16.171.0
b. 172.16.170.255
c. 172.16.171.255
d. 172.16.171.171
e. 172.16.170.0
Ans: b.d.e (我猜的) [a.c都是特殊位址]

037. You want to set the default route of your linux box to the gateway
192.168.0.1. What command do you use?
a. route add default 192.168.0.1
b. route -add default 192.168.0.1
c. route add default gw 192.168.0.1
d. route add gw 192.168.0.1
e. route add default -gw 192.168.0.1
Ans: c (我猜的)

038. What program can be used to establish a ppp connection?
a. ppp-up
b. ppp-connect
c. ppp-dial
d. wvdial
e. dial
Ans: b (我猜的)

039. You want to change from inetd to xinetd. What is necessary to do,
so that the settings from inetd can be used by xinetd?
a. Nothing, xinetd and inetd use the same configuration file
b. Rename the file /etc/inetd.conf to /etc/xinetd.conf
c. The file syntax is totaly different, so you have to write a new configuration file
d. Use the script xconv.pl, included with xinetd
e. Use the script xindet-convert, included with xinetd
Ans: d

040. What is the name of the main apache configuration file (just the name, no path)?
Ans: httpd.conf

041. What command is used to create key pairs for the ssh daemon?
a. sshkeygen
b. ssh-keygen
c. mksshkeys
d. makekey
e. mkkeys
Ans: b

042. What search option is used by the find program to find files with
SUID bit set?
a. -suid
b. -sbit
c. -perm
d. -security
e. -bit

選 c
試試 find /bin -perm +4000 -exec ls -l {} \;

沒有留言:

搜尋此網誌

本站大事記

這個部落格(網站)內容以分享LINUX和延伸出的技術文章為主!
特別是為了工作和進修需要,搜集了不少網站連結。
希望對來這裡觀文的朋友們,有提供一些有用的資訊或文章。
但這裡的文章中,也包含個人的心情扎記和隨興言談……
若是當中沒有對上你的口味,請多包涵!

原「琳娜絲與希斯寇的邂逅」,改名為「愛上琳娜絲」!

原「琳娜絲與希斯寇的邂逅」,改名為「愛上琳娜絲」!
--原序文--
就是當LINUX遇上CISCO啦!他們的結合還能作什麼事…不就是讓這個世界的網路,串…串起來啊…不然你們那能上這網站看部落格!