[理学]UNIX试卷及课后习题与答案_第1页
[理学]UNIX试卷及课后习题与答案_第2页
[理学]UNIX试卷及课后习题与答案_第3页
[理学]UNIX试卷及课后习题与答案_第4页
[理学]UNIX试卷及课后习题与答案_第5页
已阅读5页,还剩34页未读 继续免费阅读

下载本文档

版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领

文档简介

1、试卷a一、单项选择题(在每小题的备选答案中,选出正确的答案。请将答案填写在答题纸上,每小题1分,共20分)1. you want to save vi changes to the file myfile with : w!. but vi complains it can not write to the file. therefore, you want to check the write permissions on the file. to do this without leaving vi, you type:a. :!ls -l myfileb. :s -l myfilec.

2、esc:ls -l myfiled. :?ls -l myfile 2. what is the proper option to put in /etc/fstab to enable user quotas for a particular partition?a. usrquotab. userquotac. userquoatasd. usrquotas 3. which of the following commands would display the lines containing capital letters from the file "turkey.txt&

3、quot; ?a. cat turkey .txt |wc - |b. grep -n a-z turkey.txtc. cat turkey.tst |wc -w a-zd. grep -v a-z < turkey.txte. for a-z in turkey.txt i count 4. what run level represents multi-user?a. 3b. 0c. 1d. 5 5. which of the following can be used to switch your system to run level 1?a. init 1b. inittab

4、 1c. rlevel 1d. level 1 6. what would the following line accomplish if run as root?chown -r bert /home/bert/*a. nothing, this command is invalid.b. it would revoke bert's ownership from his home directory to root.c. it would change user ownership of all files in /home/bert to bert.d. it would se

5、t the group ownership of the directory /home/bert to bert'.e. it would set ownership of all files and subdirectories in /home/bert to bert. 7. if you set the umask to 022, by default what permissions will your files have?a. 0220b. 0557c. 0644d. 0755 8. what are the default permissions for the re

6、d hat /etc/passwd file?a. 644b. 640c. 400d. 641e. 440 9. how can you set the sgid on a file called happylinuxexaminator?a. chmod u+s happylinuxexaminatorb. chmod g+s happylinuxexaminatorc. chmod o+s happylinuxexaminatord. chmod u+t happylinuxexaminator 10. which one of the following programs will on

7、ly find files that are in your path?a. locateb. slocatec. whichd. find 11. to convert all uppercase letters in a stream to lowercase, pipe the stream into which command:a. tr 'a-z' 'a-z'b. tac a-z a- zc. sed /a-z/a-zd. sed -tolowere. conv a-z a-z 12. what utility would you use to rem

8、ove/display columns from each line of a file?a. pwdb. colc. cutd. taile. extract 13. which of the commands will show you only the middle 10 lines of a 30 line text file named textfile?a. head -n 11-20 textfileb. head -n 20 textfile | tailc. tail -n 11-20d. cat textfile | pr -n 11-20e. nl -n 11-30 te

9、xtfile 14. which of these commands would report how many total accounts (including special accounts) there are?a. count /etc/passwdb. nl /etc/passwd | headc. wc -users /etc/passwdd. wc -lines /etc/passwde. expand -lines /etc/passwd 15. you run the following commands:user prompt $ nice -n 1 program1u

10、ser prompt $ nice -n 5 program2user prompt $ nice -n 10 program3which of the programs started will have the highest priority?a. program1b. program2c. program3 16. when the kill command is given with only the pip number of the process to kill (as in 'kill 1234'), this corresponds to which typ

11、e of kill signal?a. 2 (sigint)b. 1 (sighup)c. 9 (sigkill)d. 3 (sigquit)e. 15 (sigterm) 17. what key sequence will suspend the current process and return you to a shell prompt?a. ctrl-zb. ctrl-cc. ctrl-xd. ctrl-d 18. you have a system that uses lilo from the master boot record. you have just recompil

12、ed a new kernel. you already have a backup kernel setup to boot from lilo so you overwrite your existing kernel with new kernel image using the same name and location. when you reboot, you find that the system does not boot. what is likely to be the problem?a. the new kernel image is above the 1024

13、cylinder and therefore cannot be loaded.b. you did not update your/etc/lilo.conf file to boot the new kernel.c. you need to boot the new kernel with a boot floppy to restore the old kernel.d. you rebooted before re-installing lilo in the master boot record. 19. tamika is planning the partition table

14、 for her new workstation. assuming she will give each of the following directories its own partition, which partition should be the largest?a. /usrb. /libc. /rootd. /bin 20. what command with switches will display the disk utilization for all mounted file systems?a. dfb. vmstatc. dud. tope. free 二、多

15、项选择题(在每小题的备选答案中,选出正确的答案,多选或少选都不计分。请将答案填写在答题纸上,每小题2分,共20分)1. select all the ways of exiting and saving a vi session.a. :wqb. :wc. :zzd. shift zze. :xf. :exit 2. a user needs to search a file for lines that contain the asterisk (*) character. which grep search command will accomplish this? choose all

16、that apply.a. grep * textfileb. grep '*' textfilec. grep "*" textfiled. grep <*> textfilee. grep "'*'" textfile 3. you need to alter the permissions on the directory /home/mrking and all it's contents to match the following permissions. drwxr-r- which of

17、 these commands with options and arguments will accomplish this? choose two.a. chmod 0744 /home/mrking -rb. chmod 744 /home/mrking/*c. chmod -r u=rwx,g=r,o=r /home/mrkingd. chmod u+rwx,g+r,o+r /home/mrking 4. what will the command "kill -hup 1354" do? select all the applya. the same as kil

18、l -9 1354b. the same as kill 15 1354c. the same as kill -15 1354d. the same as kill -sighup 1354e. the same as kill -1 1354 5. which three of the following commands are used when setting up and accessing a new file system on the hard drive? (select three correct answers)a. fsckb. mkfsc. mountd. fdis

19、ke. format 6. which of the following are executed only during a login sessiona. /etc/profileb. /etc/bashrcc. /.bashrcd. /.bash_profilee. /.bash_logout 7. which of the following directories would be the least likely to need backing up? choose two.a. /usrb. /etcc. /homed. /tmpe. /swap 8. which of the

20、following will copy file1.txt to file2.txt? choose two.a. cat file1.txt > file2.txtb. cat file1.txt | file2.txtc. cp file1.txt > file2.txtd. cp file1.txt file2.txte. cpio < file1.txt > file2.txt 9. which of the following commands could be used to see which processes are currently running

21、?(select all that apply.)a. wb. psc. topd. proce. lsproc 10. man pages may be written about which of the following?(select all that apply)?a. user commandsb. system policiesc. superuser comamndsd. programming librariese. configuration commands 三、简答题(请将答案填写在答题纸上,每小题2分,共10分),简述下列常用unix命令完成什么功能。1. ls2.

22、 find3. vi4. grep5. kill 四、 问答题(每题5分,共20分)1命令ifconfig有很多选项,如何得知使用哪个选项可以修改系统当前的ip? 2用户tux1有一个重要的文件report.txt,为保证该文件不会被无意地修改,移走和删除,应当采取什么措施? 3 如何检索目录/src以及其子孙目录中的所有文件名后缀为.c和.h文件,查找哪些文件中含有字符串udp,并列出在这文件中的行号。 4 统计出由用户tux1创建并且正在运行的进程数目。 五、论述题(每题10分,共10分)1.aix的lvm包括哪些组件,它们之间有什么关系,lvm和传统的存储方式相比有什么优点?六、编程题

23、(每题10分,共20分)1编写一段脚本程序,可以从键盘输入三个整数a,b,c,并且求出a*(b+c)的值。2编写一段bash程序,使用菜单界面,实现目录的备份和恢复。试卷b一、单项选择题(在每小题的备选答案中,选出正确的答案。请将答案填写在答题纸上,每小题1分,共20分)1. after starting vi to edit an existing text file. you press 'a' (shift + a). this will let you:a. insert text at the end of the current lineb. insert text

24、 at the end of the current sentencec. insert text after your current cursor positiond. insert text at the end of the filee. insert text at the end of your current paragraph 2. what is the proper option to put in /etc/fstab to enable group quotas for a particular partition?a. groupquotab. grpquotac.

25、groupquoatasd. grpquotas 3. you have created a really long letter and after you are done you notice that you used the name "bob" many times but you forgot to capitalize it in many instances. which command would replace "bob" with "bob" in all instances and generate a ne

26、w letter for printing?a. sed '/bob/bob' letter > newletterb. sed s/bob/bob/ letter < newletterc. sed 's/bob/bob' letter > newletterd. sed 's/bob/bob/' letter > newlettere. sed 's/bob.bob/' letter > newletter 4. what run level represents administration m

27、ode?a. 0b. 1c. 6d. 5 5. what file does init processes use as its control file?a. /etc/inittabb. /etc/procc. /etc/initd. /etc/initproc 6. which of the following commands makes /bin/foo executable by everyone but only writable by its owner ?a. chmod 557 /bin/foob. chmod o+rwx,a+rx /bin/fooc. chown 557

28、 /bin/food. chmod 755 /bin/foo 7. which of the following commands will change the owner of the file/bin/foo from the foo user to the bar user without affecting group ownership?a. chown /bin /foo barb. chown bar /bin/fooc. chown bat. foo /bin/feed. chown foo. bar/bin/foo 8. your umask is set to 002.

29、if you create a new file, what will the permission of the new file be?a. -rw-rw-r-b. -rwxrwx-w-c. -w-d. -rwxrwxr-x 9. what are the default permissions on the red hat /etc/shadow file?a. 644b. 600c. 400d. 444e. 640 10. what command can find the program file "bar" and it's associated man

30、 pages and any existing source files, but not return all files that have "bar" in the command name or path?a. whereisb. findc. located. apropose. whatis 11. which of the following would copy the file file1, txt to file2, txt?a. cp file1.txt | file2.txtb. cat file1.txt | file2.txtc. cat fil

31、e1.txt > file2.txtd. copy file1.txt | file2.txte. cat | file1.txt | file2.txt 12. which line below would count the total number of lines with the word "reject" in /var/log/mail log?a. wc -| 'reject/ var/ log/ maillog'b. for "reject" in mail log (count) +1c. wc -|/var/l

32、og/maillog | grep 'reject'd. cat /var/log/maillog | grep 'reject' | wc -le. cat /var/log/maillog | grep 'reject' | wc -r 13. to change all lower case characters in a file to upper case, pick the correct command.a. tr 'a-z' 'a-z' fileb. tr a-z a-z <filec. tr

33、 "a-z" "a-z" filed. tr 'a-z' 'a-z' < filee. tr a-z a-z > file 14. which command will display in reverse order a file that is numbered from 1 to end of file?a. cat file | nl | prb. cat file | nl | tacc. cat file | tac | nld. cat file | pr -n | reversee. none

34、of the above 15. what is the disadvantage of using the command kill -9 ?a. a core dump file will be created.b. it affects the entire process group.c. it makes excessive use of system resources.d. the action can be blocked by buggy or malicious processes.e. the affected process is unable to clean up

35、before exiting. 16. to keep a process running after you logged out, you start it with the command:a. nohupb. fgc. lived. sh 17. where can lilo place boot code?a. the boot romb. the boot ramc. the/boot partitiond. the mbr on a hard drive 18. when partitioning a disk with more than 1024 cylinders, whi

36、ch of the following could affect the systems ability to boot?a. location of lilo on diskb. location of /boot on diskc. location /var on diskd. disk transfer ratee. disk seek time 19. identify the proper device for the third partition, on the second hard disk, on the first ide controller on a pc syst

37、em.a. /dev/hdb3b. /dev/hd1b3c. /dev/hdc1b3d. /dev/hdc1d2p3 20. which command will show the number of free and used inodes for your system's mounted file systems?a. du -ib. df -ic. ls -ir /d. freeinodes 二、多项选择题(在每小题的备选答案中,选出正确的答案,多选或少选都不计分。请将答案填写在答题纸上,每小题2分,共20分)1. you want to configure user quot

38、as for the /home filesystem. you've installed the quota packages. what else needs to be done to enable the filesystem's quotas? choose all that apply.a. add usrquota to the /etc/fstab options columnb. run the quotaon commandc. run the quotacheck -avug commandd. edit the user's quota sett

39、ingse. remount the file system 2. one of the lines in the output from the command 'ls -l /home/poms' is:drwxrwsr-x 3 deve1 poms 1024 oct 22 16:28 foothe output from the command groups bubba is:bubba : bubba poms actsif user bubba executes the command touch /home/poms/foo/bar, which two of th

40、e following must be true?a. the group for/home/poma/foo/bar will be poms.b. the owner for/home/poma/foo/bar will be dove/.c. the owner for/home/poma/foo/bar will be bubba.d. the group for /home/poma/foo/bar will be bubba.e. the permissions for/home/poms/foo/bar will allow group read. 3. what two per

41、missions must a user have in order to run a shell script?a. readb. writec. executed. browse on the directorye. users cannot run shell scripts 4. which two programs will allow you to change the priority of a program already running? (select two that apply.)a. topb. nicec. niceitd. renicee. chnice 5.

42、which three of the following commands are used when setting up and accessing a new file system on the hard drive? (select three correct answers)a. fsckb. mkfsc. mountd. fdiske. format 6. what two things does the /etc/fstab file contain references to?a. file systemsb. mount pointsc. user optionsd. fi

43、le system defaultse. file system permissions 7. according to the filesystem heirarchy standard, what directory trees are considered optional on a system's root filesystem? choose all that apply.a. /mntb. /rootc. /usrd. /vare. /opt 8. what steps need to be performed, to make a new disk accessible

44、 to users?a. fdiskb. mkfsc. mountd. state. quotaon 9. which of the following are valid ways of getting a list of all processes running on the system?(select all tha apply)?a. ps fub. ps axc. pstreed. pstree -ae. echo /proc/0-9* 10. which of the following statements are true?(select all that apply.)a

45、. the default "nice" priority value is 0.b. "nice" priority values range from 0 to 20.c. lower "nice" priority values signify greater priority.d. only the superuser may assign a process maximum priority.e. setting a process's "nice" value to the lowest pri

46、ority is the same as stopping the process. 三、简答题(请将答案填写在答题纸上,每小题2分,共10分),简述下列常用unix命令完成什么功能。1. tar2. wc3. od4. cat5. chmod 四、问答题(每题5分,共20分)1如何删除当前目录下的子目录tmp及该目录下属的所有文件和子孙目录。2去掉文件list.txt中的所有空行(所谓空行指:行内不含有任何除空格之外的字符),存为新文件list-new.txt。3目录的x权限起什么作用?root用户拥有的目录树src下有许多子目录,每个子目录中也有若干个文件。现在root用户希望把这个目录树

47、下所有子目录对所有用户开放x权限,但普通文件的权限不修改。怎样才能完成这个工作?4echo *与echo *的执行结果有什么区别?为什么?五、论述题(每题10分,共10分)1aix的启动模式有哪几种,每种模式分别有什么作用? 六、编程题 (每题10分,共20分)1编写一段脚本程序,可以从键盘输入三个整数a,b,c,并且求出a*(b+c)的值。 2、编写一段bash程序,方便linux用户对u盘的加载、卸载操作过程。程序要求实现以下5个功能:1)加载u盘2)卸载u盘3)查看加载后的u盘信息4)从linux分区的硬盘中拷贝文件到u盘上5)从u盘中拷贝文件到linux分区的硬盘指定位置上。模拟试卷b

48、标准答案一、单选题1-5: abdba6-10: dbaca11-15: cddbe16-20: adbab 二、多选题1.abcde2.ad3.ac/ad?4.ad5.bcd6.ab7.cde8.abc9.bcde10.acd 三、简答题1tar磁带归档命令。命令原用于将一批文件或目录树与磁带之间进行交换(导入导出),现常用于将一个目录树打包成一个文件或者从打包文件还原目录树并兼有数据压缩/解压缩功能,用于磁盘文件的备份与转运。2wc字计数功能。统计文件中的字符数,单词数和行数。3od列出文件内容,可以按照8进制或16进制列出一个文件的各个字节的内容,一般常用于观察和逐字节分析非文本文件内容

49、。4cat命令把一个或多个文件连接成一个文件打印到它的输出或重定向到文件。5、chmod主要用于修改文件或目录的访问权限。四、问答题(每题5分,共20分)1、使用rm命令,rm命令有个选项可以递归地删除一个子目录,命令为rm r tmp2、使用grep命令可以用正则表达式对文本文件过滤,-v选项用于筛选掉能匹配指定正则表达式的行,描述一个空行的正则表达式为 *$,即:从行首开始(),有零个到多个空格( *),然后是行尾($),命令为:grep v *$ list.txt > list-new.txt3、(1)目录的x权限意味着分析路径名过程中可检索该目录。(2)完成这个要求可以使用fin

50、d命令遍历目录树eldk,符合规定条件“类型是目录”(-type d),执行指定动作“修改权限”(-exec chmod a+x ;)完整的命令为:find src -type d -exec chmod a+x ;4、按照shell对文件通配符的处理方式,后者的*将被首先替换为当前目录下得所有文件和目录名,前者由于有了双引号,这种替换被禁止。所以,前者打印星号,后者打印当前目录下所有的文件和目录名。五、论述题1. normal模式:多用户模式,有登录提示符,启动服务与进程,正常对外服务状态system management services模式:没有启动aix系统,从firmware启动,设

51、置启动顺序等,做硬件维护maintenance模式:单用户模式,没有对外服务,恢复root密码,修复机器不能启动,做系统维护diagnostics模式:诊断状态,要启动aix系统,做系统和硬件诊断六、编程题1、#!/bin/bashecho n ”input a:”; read aecho n ”input b:”; read becho n ”input c:”; read cv=expr $a * ( $b + $c ) echo ”a*(b+c)=$v” 2、#!/bin/bash#mountusb.sh#退出程序函数quit() clear echo "*" ech

52、o "* thank you to use , good bye! *" echo "*" exit 0 #加载u盘函数mountusb() clear mkdir /mnt/usb #查看ubs设备名称 /sbin/fdisk -l | grep /dev/sd echo -e "please enter the device name of usb as shown above:c" read parameter mount /dev/$ parameter /mnt/usb#卸载u盘函数umountusb() clear umount /mnt/usb#显示u盘信息函数display() clear ls -l /mnt/usb#拷贝硬盘文件到u盘函数 cpdisktousb() clear echo -e "please enter the filename to be copied(under current directory):c" read file echo "copying, please wiat!." cp /mnt/usb/$file .c

温馨提示

  • 1. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
  • 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
  • 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
  • 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
  • 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
  • 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
  • 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。

评论

0/150

提交评论