文章详情

  • 游戏榜单
  • 软件榜单
关闭导航
热搜榜
热门下载
热门标签
php爱好者> php文档>lpic- 102考试笔记

lpic- 102考试笔记

时间:2007-04-19  来源:适兕

1、/etc/printcap配置文件的阅读。
The hosts.lpd file provides:A listening of hosts allowed to use printers on the local machine.
本地打印机条目标/etc/printcap中字段描述:
sd   spool目录
mx   块中打印任务的最大尺寸。0表示无限制。
sh    抑制头页
lp     本地打印机设备
if      进行统计的文本过滤器名称
lf      错误日志的位置
rm  远程计算机
rp   远程打印机
2、man的数字表示含义。

1 命令 命令的使用方法,可以使用的参数等。 2 系统调用 只有系统才能执行的函数 3 库调用 大多是 libc 函数,如 qsort(3) 4 特殊文件 文件在 /dev 中。 5、文件的格式,比如 /etc/passwd 及其他可读文件。 6 游戏
7 宏命令包和约定 一些描述,关于标准文件系统设计、网络协议,ASCII 和 其他字符编码、man page (手册页)和其他。 8 系统管理命令 诸如 mount(8) 之类的命令,多数只有 root 可以执行。 9 内核程序 这个章节几乎不用了。 原来曾想把一些关于核心的文件放在这里, 但是实际上只有极少数可以写成文件放在这里,而且它们也很快过时了。 核心开发者可以找到其他更好的资源。              1 Commands
                        Those commands that can be executed by the user from within a shell.

              2 System calls
                        Those functions which must be performed by the kernel.

              3 Library calls
                        Most of the libc functions, such as qsort(3).

              4 Special files
                        Files found in /dev.

              5 File formats and conventions
                        The format for /etc/passwd and other human-readable files.

              6 Games

              7 Conventions and miscellaneous
                        A  description  of  the standard file system layout, network protocols, ASCII and other character
                        codes, this man page, and other things.

              8 System management commands
                        Commands like mount(8), many of which only root can execute.

              9 Kernel routines
                        This is an obsolete manual section.  Once it was thought a good idea to document the Linux kernel
                        here,  but in fact very little has been documented, and the documentation that exists is outdated
                        already. There are better sources of information for kernel developers.man还有参数的选择,比如man -k等同于whatis,man -f 等同于apropos,
3、监听端口143的协议,/etc/services

imap            143/tcp         imap2           # Interim Mail Access Proto v2
imap            143/udp         imap24、C类ip各子网划分表
Table 19-1. Class C IP subnet detail

Subnet mask

Number of subnets

Network address

Broadcast address

Minimum IP address

Maximum IP address

Number of hosts

Total hosts

128

2

0

127

1

126

126

 
   

128

255

129

254

126

252

192

4

0

63

1

62

62

 
   

64

127

65

126

62

 
   

128

191

129

190

62

 
   

192

255

193

254

62

248

224

8

0

31

1

30

30

 
   

32

63

33

62

30

 
   

64

95

65

94

30

 
   

96

127

97

126

30

 
   

128

159

129

158

30

 
   

160

191

161

190

30

 
   

192

223

193

222

30

 
   

224

255

225

254

30

240


从表中了解其运算和运行原理,比自己在黑暗中摸索强过不知多少倍!
5、可能会考到的常用的协议:
Table 19-2. Common privileged port numbers

Port number

Assigned use

Description

20 21

FTP data FTP control

When an FTP session is opened, the binary or ASCII data flows to the server using port 20, while control information flows on port 21. During use, both ports are managed by an FTP daemon, such as vftpd.

23

Telnet server

Inbound Telnet requests are sent to server port 23 and processed by telnetd.

25

SMTP server

This port is used by mail transfer agents (MTAs), such as Sendmail.

53

DNS server

Used by the Domain Name System (DNS) server, named.

67

BOOTP/DHCP server

Hands out IP addresses to workstations dynamically.

68

BOOTP/DHCP client

The client side for BOOTP/DHCP.

80

HTTP server

Web servers, such as Apache (httpd), usually listen in on this port.

110

POP3

The Post Office Protocol (POP) is used by mail client programs to transfer mail from a server.

119

NNTP server

This port is used by news servers for Usenet news.

139

NetBIOS

Reserved for Microsoft's LAN Manager.

143

IMAP

An alternate to POP3, Internet Message Access Protocol (IMAP) is another type of mail protocol.

161

SNMP

Agents running on monitored systems use this port for access to the Simple Network Management Protocol (SNMP).

6、/etc/aliaes文件的特性

sendmail doesn't actually read the text aliases file, since it's not uncommon to find many aliases defined there. Instead, it reads a compiled database file, /etc/aliases.db, built from /etc/aliases. Therefore, the database must be updated after any change is made to aliases, using the newaliases command. newaliases has no options and must be run as root.同其产生相同的结果是sendmail -bi,这就又类似于man -f替代whatis,man -k 替代apropos的结果。


此特性类似于:

ldconfig生成系统的动态链接库的原理,系统读的文件是ld.so.cache,而不是我们人工可以查看、修改、编辑的ld.so.conf.

ld.so.cache与ld.so.conf

当然也不能放过nfs,这个既让人爱,有让人恨的共享服务。
After modifying /etc/exports, what must be done to make the modifications available to users? Type
the command with any options and arguments.
Answer: exportfs -a



7、开始进入题海战术:
a、
What command will verify the syntax of a hosts.allow and hosts.deny file combination?
A. tcpdchk
B. verify --tcp
C. ipswitch
D. tcpdump
E. tcpdmatch
Answer: A
b、
When starting vi with the file nohup.out, which of the following will enable onscreen numbers?
A. vi +/set num nohup.out
B. vi +"se nu" nohup.out
C. vi /+"set number" nohup.out
D. vi +":set num" nohup.out
E. echo "set numb" | vi nohup.out
Answer: B
c、
What command will set a regular users password to force changing it every 60 days? Choose all that
apply.
A. passwd -x 60 user1
B. chage -M 60 user1
C. passwd +x 60 user1
D. useradd -e 60 user1
E. usermod -f 60 user1
Answer: A, B
d、
Which of the following commands will flush all print jobs on all configured queues of the system?
A. lprm -a all
B. lprm -all
C. lprm -a *
D. lpflush -all
Answer: A
e、
Which two commands share the same database for retrieving information?
A. whatis
B. whereis
C. apropos
D. find
E. man
Answer: A, C
f、
Which commands will print two copies of the file to the default printer? Choose all that apply.
A. cat hosts | lpr -#2
B. lpr -K2 hosts
C. lpr -P -count 2 hosts
D. cat hosts > lpr ; cat hosts > lpr
E. for 1 in 2 lpr hosts
Answer: A, B
g、
What modprobe option will cause inactive kernel modules to be unloaded?
A. autoclean
B. inactive
C. remove
D. timeout
E. holdoff
Answer: A
h、
What command with options will cause the redirection symbol (>) to fail to overwrite the contents of
an existing file?
A. set -o noclobber
B. set +o nooverwrite
C. export OVERWRITE=no
D. alias >='!>'
E. None of the choices
Answer: A
i、
What ppp option governs how long an interrupted connection will remain down before it attempts to
reconnect?
A. holddown
B. holdoff
C. inactive
D. delay
E. wait
Answer: B
j、linux所支持的路由协议。
Select from the list below the daemons that are present on a standard Linux server to support routing.
Choose all that apply.
A. gated
B. ripd
C. routed
D. ospfd
E. bgpd
Answer: B, C, D, E
k、/etc/exports语法(两道)
What will the following line in the /etc/exports file do?
/data snowblower(rw) badhost (ro)
A. Give snowblower rw access to the data share, deny badhost any access, and allow ro for all other
hosts
B. Give snowblower rw access to the data share, give badhost ro access to share and deny all others
C. Give snowblower no access to the data share, give badhost rw access and set ro access for all others
D. Cause a syntax error
Answer: A

You've just finished editing a new entry in the /etc/exports file. Which of the following will cause the
changes to take effect without interrupting current connected users or rebooting the machine?
Choose all that apply.
A. exportfs -a
B. /etc/rc.d/init.d/nfs restart
C. service nfs restart
D. kill -1 HUP nfs
E. init 1
Answer: A
l、此题更为精彩,两个知识点结合起来考。。
Your investigation of a system turns up a file that contains the line below:
find /home -iname .rhosts -exec rm -f {} \;
What is the purpose of this script?
A. To enhance system security
B. To remove all program error dumps
C. To remove all temporary files in the user's home directories
D. To reset the configuration for the rsh and rexec utilities
答案:A
m、又是该死的ppp
When using the PPP daemon make a connection, what option is set to configure it to use hardware
flow control?
A. crtscts
B. rsync
C. nsync
D. connect
Answer: A
n、打印机的安全设置也是考试内容
A file exists on a server, but has no content. Users cannot submit jobs to an attached printer. Choose
the correct file that must be edited to fix this problem.
A. /etc/hosts
B. /etc/hosts.allow
C. /etc/host.deny
D. /etc/hosts.lpd
E. /var/spool/hosts.lpd
Answer: D
o、 针对于特定的系统来考核,那么你只局限于一种linux发行版,那么要小心了,最起码考lpi,机器必须安装三个系统:redhat系列、suse系列、 debian系列,当然更希望lpi能加入更多的系统,比如gentoo系列,关于linux vym参考地址:http://blog.chinaunix.net/photo/6303_070323145931.jpg
On a debian system which of the following would build a boot disk
A. mkboot /dev/floppy
B. makeboot --device /dev/fd0 2.4.18-12
C. mkboot --device /dev/fd0 2.4.18-12
D. mkboot /boot/vmlinux-2.4.18-12
E. mkbootdisk /boot/vmlinux-2.4.18-12
Answer: D
p、ppp我何时能学会?
When using /etc/ppp/peers/* files, which of the following is true:
A. The /etc/ppp/options should be empty.
B. Any user can run pppd from the command line.
C. The dial-on-demand option cannot be used.
D. You must use chap authentication.
Answer: A
q、打印,命令行打印!这在视窗界面风行的年代,是多么可悲的一面?
What program do you use to suspend a printer queue?
A. lpr
B. lpq
C. lpc
D. lpd
E. lprm
Answer: C
r、此题的蹊跷在于注释/etc/passwd中的行和普遍linux的配置文件或脚本有不同的地方,通常使用#在行首,但是/etc/passwd似乎有其特殊之处。
You have a user whose account you want to disable but not remove.
What should you do?
A. Edit /etc/gshadow and just remove his name.
B. Edit /etc/passwd and change all numbers to 0.
C. Edit /etc/shadow file and remove the last field.
D. Edit /etc/passwd and insert an * after the first :.
E. Edit /etc/group file and put a # sign in front of his name.
Answer: D

s、/etc/syslog.conf配置文件的语法问题,正确的语法如下:
facility.level action
facility是消息产生者,可以分为以下几种类型:
mark mail auth daemon news syslog kern authpriv cron lpr user local0-local7
level设置定义了日志文件的详细程度。从最light到最heavy的有如下:
1 debug
2 info
3 notice
4 warning
5 err
6 crit
7 alert
8 emerg
还有一个可选设置,那就是不记录none.
facility和level设置一起形成了message selector,使用*则是所有功能与所有级别。
action定义了日志文件的位置:可以是下面的任意一种
 文件名(包含路径)
 主机名跟在@后面
 由逗号分开的用户列表
 由星号分开的用户列表(定义了将被包括的登录用户)
常见位置:
         /dev/xconsole,记录到控制台。
        /var/log/messages,/var/log/mail.*,/var/log/news/news.*.
You are working in a graphical environment and trying to configure PPP, but are having problems.
You know that PPP uses the local2 facility for logging. To better watch what's going on, you decide to
open an Xconsole session and sent all local2 messages there.
How should you configure /etc/syslog.conf to show you all messages sent from PPP?
A. local2.* /dev/console
B. local2.* /dev/xconsole
C. *.local2 /dev/xconsole
D. *.local2 *
Answer: A
t、此题颇为实在,我们常使用w这个命令来查看都是谁登录了系统,在那个终端下,那么此题就可以解释。
Type the full path and name of the file whose global read bit you would change to deny normal users
the ability to get useful information from the who and w commands.
Answer: /var/run/utmp
u、samba服务,有很多需要挖掘的地方,比如swat以前我就不知道这个工具。
Type the command to check the syntax and contents of the smb.conf file.
Answer: testparm
v、环境变量的设置,也是要掌握的内容。env的输出都应该读懂。
You are using insmod. You do not want to use the default configuration file /etc/modules.conf. What
environment variable should you modify:
Answer: MODULECONF
解释: The environment variable MODULECONF can also be used to select a different
configuration file from the default /etc/modules.conf (or /etc/conf.modules (deprecated)). This
environment variable will override all the definitions above.
If the module file name is given without directories or extension, insmod will search for the module in
some common default directories. What environment variable can be used to override this:
Answer: MODPATH
解释: If the module file name is given without directories or extension, insmod will search for
the module in some common default directories. The environment variable MODPATH can be used to
override this default. If a module configuration file such as /etc/modules.conf exists, it will override the
paths defined in MODPATH.

8、cron语法应该熟悉,不是简单的记住,而要灵活应用。

文 件/etc/crontab中 每行任务的描述格式如下:

minute hour day month dayofweek command

  • minute - 从0 到 59的 整数
  • hour - 从0到23的 整数
  • day - 从1到31的 整数 (必须是指定月份的有效日期)
  • month - 从1到12的 整数 (或如Jan或Feb简写的月份)
  • dayofweek - 从0到7的整数,0或7用来描述周日 (或 用Sun或Mon简 写来表示)
  • command - 需要执行的命令(可 用as ls /proc >> /tmp/proc或 执行自定义脚本的命令)

对 于以上各语句,星 号(*)表 示所有可用的值. 例 如,*在 指代month时 表示每月执行(需要符合其他限制条件)该命令。

整 数间的连字号(-)表 示整数列,例 如1-4意 思是整数1,2,3,4.

指 定数值由逗号分开。如:3,4,6,8表 示这四个指定整数.

符 号“/”指 定步进设置.“/<interger>”表 示步进值。如0-59/2定 义每两分钟执行一次。步进值也可用星号表示。如*/3用 来运行每三个月份运行指定任务.

以“#”开 头的为注释行,不 会被执行。


红色部分是颇为重要的:比如下面这两道题:


Which of the following will run a file named myscript every 23 minutes past midnight every two
hours?
A. 23 0-23/2 * * * /myscript
B. 23 */0-23 * * * /myscript
C. 23 @2 * * * /myscript
D. 11 2/0-23 * * * /myscript
Answer: A


A crontab must at least every 11 minutes. The job may take up to 7 minutes to complete, and there mustn't be two jobs at the same time. Which crontab line solves the problem?


A. */8 * * * * myjob

B. */9 * * * * myjob

C. */10 * * * * myjob

D. */11* * * * myjob

E. */12 * * * * myjob

此 处若将*号改为0-59则简单明了,一个任务至少要每11分钟执行一次,每次运行7分钟,且系统不能容忍同时执行两个同样的任务,而此处的疑问是 crontab,在0-59之间是按每分钟执行的没错,但它到达下一个0-59时是怎么处理的了呢?重置?还是要算上一个0-59的余数?比如此题: 60/11=5...5那么剩下的这5分钟计不计入下一个小时了呢?看来只能作实验了!!!



9、进程的正常退出,exit 0

 What is considered the normal exit value of a process?
Answer: 0 (or Zero)

但是此处的疑问是,我如何确切知道exit的其他数字的含义?



10、对于环境的设置:set的用法要掌握几许

使用set命令可以设置各种shell选项或者列出shell变量.单个选项设置常用的特性.
在某些选项之后-o参数将特殊特性打开.在某些选项之后使用+o参数将关闭某些特性,
不带任何参数的set命令将显示shell的全部变量.除非遇到非法的选项,否则set总是
返回ture.
当BASH shell被调用时,可以列出全部的选项.当前的选项集列在$-中.在option参数
被处理后,其他的参数被赋值到位置参数中($1,$2,...,$n)

set [--abefhkmnptuvxldCHP] [-o option name] [arguments ...]

源码:

选项 说明
-a 自动向已经修改的变量或为导出后序命令的变量作出标志
-b 不是在原提示符之前,而是立即引发终止后台任务的状态表表
-e 如果命令带非零值返回,立即退出
-f 禁止带扩展名的路径
-h 定义函数时,定位和存储函数命令,当函数被执行时,通常查询函数命令
-k 所有的关键词参数,而不只是那些命令名前的关键词参数,被放在环境命令中
-m 监视器模式,启动任务控制.此选项默认支持系统shell交互.后台进程以单独的进程组运行,在每次完成任务时显示包含退出的状态行
-n 读取命令但不执行命令.通常监查shell脚本的句法错误.交互shell被忽略

-o option-name 选项名可以是下列之一:
选项 说明
allexport 同-a选项
braceexpand shell执行花括号扩展,在默认情况下起作用
emacs 使用emacs风格命令行编辑接口.除非shell以-noline-editing
选项启动,否则当shell交互时,通过默认启动该选项
errexit 同-e选项
histexpand 同-H选项
ignoreeof 其结果是好像shell命令IGNOREEOF=10被执行
interactive 允许单词前带#号,以使得在交互shell中忽略命令行的全部字符
-commands
monitor 同-m选项
noclobber 同-C选项
noexec 同-n选项
noglob 同-f选项
nohash 同-d选项
notify 同-b选项
nounset 同-u选项
physical 同-p选项
posix 改变BASH属性以匹配标准,默认操作不同于POSIX1003.2标准
verbose 同-v选项
vi 使用vi风格的命令行编辑器
XTRACE 同-x选项,如果没有给出选项名,显示当前选项值
-p 打开特权模式(在此模式,$ENV文件被处理,不能从环境中继承shell函数.如果是有效用户ID而不是实用户组则自动启动.关闭此选项将使得有效用户和组IDs设置实用户和组IDs)
-t 在读取命令并执行之后退出
-u 当执行参数括展时,把非设置变量作为错误处理(如果扩展企图出现在非设置变量中,shell显示错误信息.如果不是交互式,则带非凌值退出)
-v 输入行被读取时,显示shell输入行
-x 在每个简单命令被扩展之后,显示PS4扩展值,之后是要执行的命令
-l 保存和恢复绑定在命令中的名称
-d 禁止执行查找散列命令(通常,命令被保存在散列表中,一旦被找到就不再继续查找)

-C 效果好像是执行了noclobber=shell命令-H 使用!风格的历史替代(当shell交互时,在默认情况下,此选项有效)

-P 如果设置此参数,当执行改变目录命令cd时,不遵循符号链接,而是使用实际的目录

-- 如果在选项后没有参数,不设置位置参数.否则,即使一些参数以a选项开始,也要把位置参数设置为argument- 结束选项的信号,将引发其余的参数被赋值到位置参数中(-x和-v选项被关闭.如果没有argument,位置参数将保留未改变的参数)

11、vi的常用命令及设置

 全局替换:进入vi命令模式,:1,$s/xxx/yyy/g,用yyy替换打开文件的全部xxx字符。

设置显示行号::set +o num

What file would you edit to make the current user's vi session options always take effect? Type the full path and filename.

Answer: /.exrc

12、巧用find来处理问题。

What command with options will find all files on your system that have either the SUID or GUID bits set? Type the exact command with options to accomplish this.
Answer: find / -perm +6000

13、将运行的进程或文件放入黑洞。

/dev/null,/dev/zero,/bin/nologin,/bin/false,环回网络接口lo.等,比如下面这个例子:

防止ddos分布式拒绝服务攻击竟然可以这么做。

To stop immediately a DDOS attack from 10.1.1.128, what can you do? Type the command with the necessary options and arguments.
Answer: route add 10.1.1.128 lo

格式化整个硬盘:dd if=/dev/zero of=/dev/sda(hda)

建立用户,使其不能登录useradd -s /bin/nologin(false)

14、test的解释。

test - check file types and compare values

SYNOPSIS 

test EXPRESSION test

[ EXPRESSION ] [ ] [ OPTION

DESCRIPTION 

Exit with the status determined by EXPRESSION.

--help display this help and exit --version output version information and exit

An omitted EXPRESSION defaults to false. Otherwise, EXPRESSION is true or false and sets exit status. It is one of:

( EXPRESSION ) EXPRESSION is true ! EXPRESSION EXPRESSION is false EXPRESSION1 -a EXPRESSION2 both EXPRESSION1 and EXPRESSION2 are true EXPRESSION1 -o EXPRESSION2 either EXPRESSION1 or EXPRESSION2 is true -n STRING the length of STRING is nonzero STRING equivalent to -n STRING -z STRING the length of STRING is zero STRING1 = STRING2 the strings are equal STRING1 != STRING2 the strings are not equal INTEGER1 -eq INTEGER2 INTEGER1 is equal to INTEGER2 INTEGER1 -ge INTEGER2 INTEGER1 is greater than or equal to INTEGER2 INTEGER1 -gt INTEGER2 INTEGER1 is greater than INTEGER2 INTEGER1 -le INTEGER2 INTEGER1 is less than or equal to INTEGER2 INTEGER1 -lt INTEGER2 INTEGER1 is less than INTEGER2 INTEGER1 -ne INTEGER2 INTEGER1 is not equal to INTEGER2 FILE1 -ef FILE2 FILE1 and FILE2 have the same device and inode numbers FILE1 -nt FILE2 FILE1 is newer (modification date) than FILE2 FILE1 -ot FILE2 FILE1 is older than FILE2 -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

Except for -h and -L, all FILE-related tests dereference symbolic links. Beware that parentheses need to be escaped (e.g., by backslashes) for shells. INTEGER may also be -l STRING, which evaluates to the length of STRING.

NOTE: your shell may have its own version of test and/or [, which usually supersedes the version described here. Please refer to your shell's documentation for details about the options it supports.

AUTHOR 

Written by Kevin Braunsdorf and Matthew Bradburn.

REPORTING BUGS 

Report bugs to <[email protected]>.

COPYRIGHT 

Copyright © 2006 Free Software Foundation, Inc. This is free software. You may redistribute copies of it under the terms of the GNU General Public License <http://www.gnu.org/licenses/gpl.html>. There is NO WARRANTY, to the extent permitted by law.

SEE ALSO 

The full documentation for test is maintained as a Texinfo manual. If the info and test programs are properly installed at your site, the command info test should give you access to the complete manual.

(以上的题均来自于互联网。)

相关阅读 更多 +
排行榜 更多 +
步行僵尸2无限金币版

步行僵尸2无限金币版

体育竞技 下载
狐狸一号特殊任务无限金币版

狐狸一号特殊任务无限金币版

体育竞技 下载
忍者之雷复仇无限金币钻石版

忍者之雷复仇无限金币钻石版

体育竞技 下载