Linux basic multiple choice questions and analysis 12.19

Linux basic multiple choice questions and analysis

Welcome to scan the QR code to follow the WeChat public account "Ambition and Home", reply to 12.19 to get the complete question


1. Multiple-choice questions 1. In the general format of the Linux command line, the following (C) is not a part of it.

A: Command word
B: Option
C: return value
D: Parameters

2. In the RHEL7 system, use the tar command with (D) selection, which can be used to decompress and release the archive compressed file in the format of ".tar.bz2".
A: zcf
B: zxf
C: jcf
D:jxf

解析:
A:zcf  //-c参数用于创建压缩文件,x参数用于解压文件,-f代表压缩或解压的软件包名称
B:zxf  //z代表使用Gzip
C:jcf  //打包压缩
D:jxf  //j代表使用bzip2

3. In the vi editor, you need to save and exit after modifying the content of the file, which cannot be achieved using the following (B) command.
A: ZZ in command mode
B: The last line mode: q!
C: in the last line mode: wq
D: in the last line mode: x

解析:
 A:命令模式中的ZZ  	//文件未修改则不储存离开,若修改过则保存退出
 B:末行模式中的:q!   //表示强制退出,不保存
 C:末行模式中的:wq  	//w表示保存, q表示退出
 D:末行模式中的:x  	//表示保存退出

4. In the RHEL7 system, if the "!!" character is added before the jerry user's password string in the "/etc/shadow" file, it will result in ().
A: jerry users can log in without a password
B: The account of the jerry user is locked and cannot log in
C: jerry users can log in, but it is forbidden to modify their own password
D: jerry user’s valid login password becomes "x"

解析:
shadow文件du中第二列的格式,它是加后的密码,它有些机,不同的专特殊字符表示特属殊的意义:
①.该列留空,即"::",表示该用户没有密码。
②.该列为"!",即":!:",表示该用户被锁,被锁将无法登陆,但是可能其他的登录方式是不受限制的,如ssh公钥认证的方式,su的方式。
③.该列为"*",即":*:",也表示该用户被锁,和"!"效果是一样的。
④.该列以"!"或"!!"开头,则也表示该用户被锁。
⑤.该列为"!!",即":!!:",表示该用户从来没设置过密码
注: 参考来源百度知道

5. Assuming that you are the company's system administrator, you have created a new user abc on a RHEL7 server and set a password of 123. The results are as follows:
[root@box2 ~]#cat /etc/shadow|grep abc
abc: 1 11mv3rA9k8$.R77PK0Kwx66nKqNHCGUz/:13698:0:99999:7:::

At this moment, you leave the server for a while for some reason, and use the same command when you come back. The execution result is as follows: [root@box2 ~]#cat /etc/shadow|grep abc
abc:! 1 11 mv3rA9k8$.R77PK0Kwx66nKqNHCGUz/:13698:0:99999:7::: Then someone executed the () command when you left.
A: useradd -U abc
B: usermod -U abc
C: useradd -L abc
D:usermod -L abc

解析:
passwd -l 锁定账户,在密码字符串的前面加上!!,passwd -u是去掉密码字符串前面的!!。usermod -L 默认只是锁定密码,在密码字符串前面加!,usermod -U默认只是解锁密码,去掉密码字符串前面的!

usermod不能一次解锁passwd锁定的账户,是因为passwd锁定的账户前面有两个!,usermod只是去掉一个!,所以进行两次usermod就可以解锁用户

6. In the Linux system, if you want to realize the partition /dev/sdb1 is automatically mounted to the /data directory after the system starts, you should modify the () file.

A:/etc/inittab
B:/etc/fstab
C:/boot/grub/grub.conf
D:/etc/hosts

解析:
# vim /etc/fstab	
/dev/sdb2   /backup(挂载点[mkdir ~])   ext4 defaults 0 0

7. Xiaoma is the database administrator of the Linux system. He wants to query the names of all the software packages related to the "mysql" database installed in the current system. He should execute the () command.
A: rpm –qa | mysql
B: rpm –q mysql*
C: rpm –Ua mysql*
D:rpm –qa | grep mysql

8. In the () of the vi editor, you can set the line number that displays the content of the current file.
A: Command mode
B: Terminal mode
C: Input mode
D: Last line mode

解析:
命令模式:控制光标移动,可对文本进行复制、粘贴、删除和查找等工作。 
输入模式:正常的文本录入。 
末行模式:保存或退出文档,以及设置编辑环境

 // : set nu 显示行号
 // : set nonu不显示行号

9. The commands and results executed in the Linux system are as follows:
ls –l myfile
-rwxrw-r--1 root root 0 Mar 29 20:21 myfile
user teacher is not a user in the root group, may I ask if he has () permissions on the file myfile .
A: Read only
B: read and write
C: execute
D: read and write and execute

解析:
对文件: r :可读 w: 可写(编辑、新增、修改、删除文件的实际内容)  x: 可执行
对目录: r :可读(文件列表) w: 可写(在目录内新增、删除、重命名文件) x: 可执行(进入该目录)

10. In the interactive interface of the fdisk partition tool, use the () command to create a new partition.
A: l
B: p
C:n
D:w

解析:
 A:l  //列出所有可用分区类型
 B:p  //查看分区信息
 C:n  //添加新的分区
 D:w  //保持退出

11.Infdisk partition toolIn the interactive interface, use the () command forView the current partition table
A:l
B:p
C:n
D:w

解析:
m 查看全部可用的参数 
n 添加新的分区 
d 删除某个分区信息 
l 列出所有可用的分区类型 
t 改变某个分区的类型 
p 查看分区信息 
w 保存并退出 
q 不保存直接退出

12. When using vi to edit files in RHEL7 system, use the last line command () to display the line number of each line.
A: number
B: display num
C : set no
D:set num

解析:
镜像问题:第八题
 // : set nu 显示行号
 // : set nonu不显示行号

13. There is a computer with a Linux system, and there is a text file named test in its current directory. If the administrator Xiao Zhang wants to open the file with the vi editor to view the content, he should use the () command.
A: open test
B: vi read test
C : vi test
D:open vi

14. In the Red Hat Enterprise Linux5.0 system, Xiao Wang used the command "mount /dev/cdrom /media/cdrom" to successfully read the data in the CD, and the parameter "/media/cdrom" belongs to the () file.
A: Ordinary file
B: Catalog file
C: Device file
D: Special file

15. The following () command can set the permissions of the file xfile to be read-only by the owner user.

A:chmod a=r xfile
B:chmod u=r xfile
C:chmod g-wx xfile
D:chmod o+r xfile

解析:
 //u 属主, g 属组, o 其他

16. In the RHEL7 system, the administrator sets the disk quota for user Tom as follows:
Filesystem blocks soft hard inodes soft hard
/dev/hda3 20 100 200 5 10 20
Then Tom can also store up to the /dev/had43 partition ()File.
A:180KB
B: 100KB
C: 10
D: 20

解析: 
区分 soft与hard
题中最多只能存放200
//blocks 20 表示当前已有20kb的内容
//inodes 5 表示已有5个文件
所以答案选A

17. In the Linux system, please judge that the root user has () permissions on the file text.txt based on the following commands and their execution results.
[root@localhost root]#ls –l text.txt
-rw-r–r-- 1 root root 55 2006-02-21 text.txt
A: read, write, execute
B: read, write
C: Read, execute
D: execute

18. In the RHEL7 system, the home directory of the Linux super administrator user root is located at ().
A: /boot
B:/root
C:/home/root
D:/workspace

解析: 
//宿主目录是用户自己的目录
//根目录,相当于windows系统分区的c:\ 

19. In the RHEL7 system, the default home directory of the common Linux user user1 is located in ().
A: /boot
B: /user1
C:/home/user1
D:/workspace

20. When using vi to edit files in RHEL7 system, if you want to find the string "nologin" from the bottom up, you should enter () in the command mode.

A:/nologin
B:?nologin
C:#nologin
D:%nologin

解析: 
/:表示自上而下
?:表示自下而上

21. In the RHEL7 system, to search for all files starting with "red" in the current directory and its subdirectories, you can use the () command.
A: find / red
B: find. Red
C: find. -Name "red"
D:find . -name “red*”

解析:
 find 命令中的参数以及作用  
-name 匹配名称 
-perm 匹配权限(mode 为完全匹配,-mode 为包含即可) 
-user 匹配所有者 
-group 匹配所有组 
-mtime -n +n 匹配修改内容的时间(-n 指 n 天以内,+n 指 n 天以前) 
-atime -n +n 匹配访问文件的时间(-n 指 n 天以内,+n 指 n 天以前) 
-ctime -n +n 匹配修改文件权限的时间(-n 指 n 天以内,+n 指 n 天以前) 
-nouser 匹配无所有者的文件 
-nogroup 匹配无所有组的文件 
-newer f1 !f2 匹配比文件 f1 新但比 f2 旧的文件 
--type b/d/c/p/l/f 
匹配文件类型(后面的字幕参数依次表示块设备、目录、字符设备、管道、 
链接文件、文本文件) 
-size 匹配文件的大小(+50KB 为查找超过 50KB 的文件,而-50KB 为查找小于 
50KB 的文件) 
-prune 忽略某个目录 
-exec …… {}\; 后面可跟用于进一步处理搜索结果的命令

22. In the RHEL7 system, after setting () permissions for executing program files, when other users execute the program,Will get the same identity as the owner account of the file.
A: Readable
B: Executable
C: Set UID
D: Sticky bit

解析:
SUID可以让二进制程序的执行者临时拥有属主的权限(仅对拥有执行权限的二进制程序有效
SGID主要实现如下两种功能让执行者临时拥有属组的权限,在某个目录中创建的文件自动继承该目录的用户组(只可以对目录进行设置)

23. When editing the file report.txt with vi in ​​the RHEL7 system, to search for the string "2006" from top to bottom, you should use () in the command mode.
A: /2006
B:? 2006
C: #2006
D: %2006

解析:
镜像问题:第20题
/:表示自上而下
?:表示自下而上

24. In the RHEL7 system, after Xiao Zhao used the command "mount -t iso9600 /dev/cdrom /media/cdrom" to mount the CD, he should use the () command toUninstall
A:umount /media/cdrom
B:unmount /media/cdrom
C:mount –U /media/cdrom
D:unmount –U /media/cdrom

25. In the Linux system, if you need to view the help information of the ls command, you cannot use the following () command.

A:help ls
B : ls --help
C : man ls
D : info ls

== 26 .== When using vi to edit a file in RHEL7 system, to delete the contents of lines 7 to 10 at one time, you can first move the cursor to line 7 in the command mode, and then use the () command.
A: dd
B:4dd
C : de
D : 4de

解析: 
Vim 中常用的命令 
dd 删除(剪切)光标所在整行 
5dd 删除(剪切)从光标处开始的 5 行 
yy 复制光标所在整行 
5yy 复制从光标处开始的 5行 
n 显示搜索命令定位到的下一个字符串 
N 显示搜索命令定位到的上一个字符串 
u 撤销上一步的操作 
p 将之前删除(dd)或复制(yy)过的数据粘贴到光标后面

27. Before and after executing the command "cd …", the result of executing the pwd command is the same, then the execution result of the pwd command is ().
A:/
B:/boot
C:/root
D:/home/li

28. After logging in to the character operation interface, the prompt is "#", indicating that the current user is ().

A:root
B:administrator
C:student
D:guest

29. When the vi editor is in the input mode, you can press the () key to switch to the command mode.
A: BackSpace
B: F1
C : Esc
D:Delete

30In the directory structure of the RHEL7 system, the following () directories are used to store device files such as hard disks and CDs.

A:/etc
B:/dev
C:/boot
D:/home

解析: 
 A:/etc  //系统主要的配置文件几乎都放置到这个目录内,例如人员的账号密码文件、各种服务的起始文件等。一般来说,这个目录下的各文件属性是可以让一般用户用户查阅的,但是只有root有权利修改
 B:/dev 
 C:/boot  /boot分区就是操作系统的内核及在引导过程中使用的文件
 D:/home  //如果建立一个用户,用户名是"xx",那么在/home目录下就有一个对应的/home/xx路径,用来存放用户的主目录

31. In the RHEL7 system, execute the () command to format the partition "/dev/sdb2" as a swap file system of type Swap.

A:mkfs -t swap /dev/sdb2
B:mkswap /dev/sdb2
C:swapon /dev/sdb2
D:format /dev/sdb2:swap

解析:
SWAP 分区专用的格式化命令 mkswap
mkswap命令用于在一个文件或者设备上建立交换分区

32. In the Linux system, you need to display the detailed attributes of the "/etc" directory in a long format, instead of displaying the contents of the directory, you can use the () command.

A:ls -l /etc
B:ls -lh /etc
C:ls -ld /etc
D : ls -la / etc

解析:
//'h' 参数显示文件大小
//'a'参数看到全部文件(包括隐藏文件)

33. Using the () function of the linux shell, the output result of the command can be handed over to another command for processing.
A: alias alias
B: Pipeline "|"
C: Redirected output">"
D: Tab key is automatically completed

34. If you need to query which software package "/etc/passwd" belongs to, you can execute the following () command.

A:rpm -qi /etc/passwd
B:rpm -ql /etc/passwd
C:rpm -qp /etc/passwd
D:rpm -qf /etc/passwd

35. In the Linux system, the second SCSI device should be expressed as ().
A: hd2
B: hdb
C: sd2
D:sdb

解析:
//第一块为:sda,第三块为:sdc

36. In the Red Hat Enterprise Linux5.0 system, to rename the file file1.c in the current directory to file2.c, the following command is correct ().
A: cp file1.c file2.c
B:mv file.c file2.c
C:rename file.c file2.c
D:edit file2.c

37. The following () directory stores the most basic user commands in the linux system, and ordinary users have the authority to execute them.

A:/sbin
B : / am
C:/usr
D:/var

解析:
1. /sbin 目录(system binary)是系统管理员专用的二进制代码存放目录,主要用于系统管理

2. /bin存放二进制可执行文件(ls,cat,mkdir等),常用命令一般都在这里。

3. /etc	存放系统管理和配置文件。

4./home
存放所有用户文件的根目录,是用户主目录的基点,比如用户user的主目录就是/home/user,可以用~user表示。

5./usr
用于存放系统应用程序,比较重要的目录/usr/local 本地系统管理员软件安装目录(安装系统级的应用)。这是最庞大的目录,要用到的应用程序和文件几乎都在这个目录。

6./dev  在Linux中设备都是以文件形式出现,这里的设备可以是硬盘,键盘,鼠标,网卡,终端,等设备,通过访问这些文件可以访问到相应的设备。

7./var
用于存放运行时需要改变数据的文件,也是某些大文件的溢出区,比方说各种服务的日志文件(系统启动日志等。)等

38. For security reasons, the user password of the linux system is encrypted and stored in the () file.

A:/etc/passwd
B:/etc/password
C:/etc/shadow
D:/etc/group

解析:
 A:/etc/passwd  //所创建的用户账户和其相关信息(密码除外)
 B:/etc/password  
 C:/etc/shadow  //只有root用户可读
 D:/etc/group   //存放组群账户的信息

39. When setting automatic mounting parameters in the "/etc/fstab" file, () is used to provideUser quotastand by.
A:usrquota
B: userquota
C: grpquota //grpquota (user group quota)
D: groupquota

40. A variety of shell environments are provided for users in RHEL7, among which () is the default shell provided for users.
A: bsh
B: csh
C: ksh
D:bash

41. If you need to setfileThe owner user of has read and write permissions, and any other user is read-only, the permission mode can be expressed as ().

A:566
B:644
C:655
D:764

42. In the RHEL7 system, the second logical partition in the first SCSI hard disk should be expressed as ().
A: /dev/hda2
B: /dev/sda2
C:/dev/hda6
D:/dev/sda6

解析:
//逻辑分区从5开始
//主分区或扩展分区的编号从 1 开始,到 4 结束
//扩展分区创建数个逻辑分区

43. In the last line mode of the VI editor, to findCurrent lineAll the "old" strings in and replace them with "new", you can execute the () command.
A: s/old/new
B : s/old/new/g
C :% s/old/new
D :% s/old/new/g

解析:
:s/one/two    -将当前光标所在行的第一个 one 替换成 two 
:s/one/two/g 	 -将当前光标所在行的所有 one 替换成 two 
:%s/one/two/g	 -将全文中的所有 one 替换成 two 
?字符串 		-在文本中从下至上搜索该字符串 
/字符串 		-在文本中从上至下搜索该字符串

44. In RHEL7 system, when we execute "ll", we will see the same output result as executing "ls -l", this is because of ().
A: ll is a command to display files or directories in long format
B: ll is a special symbolic link pointing to the ls command
C: ll is an alias of simplified ls -l set by the alias command
D: ll is a special function in the Linux system kernel

45. In the directory structure of the linux system, there can be () root directories.
A:1
B:2
C:3
D:4

46. ​​In the RHEL7 system, there are two files a.txt and b.txt in the current directory. The content of the a.txt file is "GNU is Not UNIX", and the content of the b.txt file is "GNU is GNU". If you execute " cat a. txt> b.txt" command, the content of the b.txt file will change to ()
A: GNU is Not UNIX GNU is GNU
B: GNU is GNU GNU is Not UNIX
C:GNU is Not UNIX
D:GNU is GNU

47. In the Linux system, "/etc/passwd", the file saves the relevant information of the user account, the administrator Xiao Liu thinksView the contents of the file, He can use the following () command to achieve.
A: ls /ect/passwd
B: ls -l /ect/passwd
C:more /etc/passwd
D:open /etc/passwd

48. If you need to query the detailed information of the RPM software package "talk" installed in the system, you can execute the () command.

A:rpm -ql talk
B:rpm -qpi talk
C:rpm -qi talk
D:rpm -qf talk

49. The file system in the Linux system is () structure
A: linearB: Tree-like C: Graphic D: Collection

50. In the following versions of the linux kernel, () is not a stable version of the kernel.

A:2.4.15
B:2.5.12
C:2.6.18
D:2.6.27

解析:
如果第二位为偶数则为稳定版,奇数不稳定

51. In the RHEL7 system, the following () operation can use the output of the cmd1 command as the input of the cmd2 command.
A:cmd1|cmd2
B:cmd2&cmd1
C:cmd1>cmd2
D:cmd2

52. In the RHEL7 system, it is known that pwd is an internal command of bash. When you execute "which pwd" to query the path where the pwd command is located, the output result is ().

A:/bin/pwd
B:/usr/bin/pwd
C:/sbin/pwd
D:no pwd in(/usr/kerberos/sbin:…)

53. In the RHEL7 system, after setting () permissions for the execution of the program file, when other users execute the program, they willObtain the same identity as the owner account of the file
A:Set UID
B: Set GID
C: Sticky bit
D: Executable

54. In the Linux system, the results of using the which command to obtain the executable file path of the mount command are as follows:
$which mount
/bin/mount
Now to query the software package that "/bin/mount" belongs to, you can use the following () command.
A: rpm -qi /bin/mount
B:rpm -qf /bin/mount
C:rpm -ql /bin/mount
D:rpm -ql /bin/mount/ |grep mount

55. () command can copy f1.txt to f2.txt?

A.cat f1.txt | f2.txt B.cat f1.txt f2.txt
C.cp f1.txt f2.txt D.copy f1.txt f2.txt

56.Linux was first developed by computer enthusiasts ().
A. Richard PetersenB. Linus Torvalds C. Rob Pick D. Linux Sarwar

57. If umask is set to 022, the default permission to create files is ()
A: 022 //The maximum file permissions are 666, and the directory maximum is 777
B: 755
C: 550
D:644

58. If you want to enter and execute multiple commands on a command line, you can use (B) to separate the command
A: commaB: semicolon C: Colon D: Dayton

59. After logging in to the system, which directory D
A:/home
B:/root
C:/usr should be entered first?
D: User's own home directory

60. If the current directory is /home/sea/china, then the parent directory of "china" is ()
A:/home/sea
B:/home/
C:/
D:/sea

2. Multiple choice questions

1. In the RHEL7 system, user jerry executes the "ls -l myfile" command in the host directory, and the information displayed is
"-rw-r----- 1 root jerry 7 07-04 20:40 myfile", then jerry User pairFile myfileThe permission is (). (Choose two)
A: You can view the contents of the file
B: You can modify the content of the file
C: You can execute the file
D: You can delete files

解析:
可读”表示能够读取文件的实际内容;“可写”表示能够 编辑、新增、修改、删除文件的

1. After creating a new user in the Linux system, it is usually necessary to set the login password for the newly added user. The user's password involves two files: shadow and passwd. The following description of these two files is correct ( Option two)

A: The two files shadow and passwd are located in the /etc directory
B: The password stored in shadow is in cipher text, while passwd is stored in plain text.
C: Any user can operate on the two files, shadow and passwd
D: Only the root user can view the contents of the shadow file

2. In the following versions of the linux kernel, () is an unstable version of the kernel.

A:2.6.15
B:2.5.12
C:2.5.18
D:2.3.27

3. In the linux system, you can create () type link files.
A: Soft link
B: Hard link
C: Long link
D: Short link

4. In the RHEL7 system, if you need to view detailed information such as the size of the file named "myfile" in the current directory, the modified date and time, you can use the following () command. (Choose two items)
A: ls /
B: ls -l /
C:ls -l myfile
D:ls -l ./myfile

5. Use the following () command to lock and unlock the user account. (Choose two)
A: useradd
B:usermod
C:passwd
D: userdel
6. The three necessary elements of authorization rules ().
A: Authorized users B: Authorization date period C: Authorized host D: Authorized command action

Guess you like

Origin blog.csdn.net/m0_46653702/article/details/111400288