14day第二次笔试

一、基础
1.1 什么是绝对路径,什么是相对路径(2 分)
1.2 简述命令执行的流程(2 分)
1.3 简述软连接与硬连接的区别(2 分)
1.4 创建目录/old/boy/(2 分)
1.5 使用一条命令在/old/boy/目录下创建 bgx1.txt、 bgx2.txt、bgx3.txt 三个文件(2 分)
1.6 将/old/boy/目录下所有内容复制到/root/目录下 (2 分)
1.7 删除/root 下所有 a 开头的文件及目录(2 分)
1.8 在/tmp/目录下面创建一个 etc 的软连接 etc-test (2 分)
1.9 写出 20 个学过的命令及含义(20 分)
1.10 以下目录的作用(8 分) bin boot dev etc home lib mnt opt proc root run sbin tmp usr var

二、awk
2.1 显示 1.txt 文件第 3 到第 10 行的内容?(2 分)
2.2 取出 IP 地址(2 分)
2.3 写一个文件,文件内容如下 cat >>test.txt< { lisTEN 80;
server_nAme docs.xuliangwei.com;
root /code/dOcs index INDEX.html;
} EOF
2.3.1 过滤 docs.xuliangwei.com 这段关键字(2 分)
2.3.2 同时过滤出 root 和 index 的行,不区分大小写 (2 分)
2.3.3 过滤 index,区分大小写(2 分)
2.3.4 过滤出带"O"的行,不区分大小写(2 分)
2.3.5 过滤出不带";"的行(2 分)

2.4 将"web3_access.log"上传至你的 linux 服务器
2.4.1 统计出该文件 IP 地址(第一列)出现的次 数,并按正序对其进行排序(2 分)
2.4.2 统计该文件内 HTTP 状态返回码出现的次数 (例如 200,404,403,在第九列),并按照倒序进行排 序(2 分)
2.4.3 过滤出所有状态返回码是 200 的行,并将这些 返回码为 200 行的全部替换成 300(2 分)
2.5 使用 hostnamectl 查看当前系统信息
[root@test-200 /home]#
hostnamectl Static hostname:
test-200 Icon name: computer-vm Chassis:
vm Machine ID: 955d9cf9777d49748690808a0b38096b
Boot ID: 9565d1bd772543beb49d178479e7c94f
Virtualization: vmware
Operating System: CentOS Linux 7 (Core) PE OS Name: cpe:/o:centos:centos:7
Kernel: Linux 3.10.0-957.el7.x86_64 Architecture: x86-64 2.5.1
取出 kernel 内核版本信息(2 分)
2.5.2 取出系统名称(2 分)
2.5.3 取出系统版本信息,只显示"linux 7"(2 分)

三、用户与权限
3.1 在 Linux 系统中,哪个文件保存着用户信息(2 分)
A:/etc/Profile B:/etc/passwd C:/usr/bin/env D:/boot
3.2 一个用户想要修改 dir 目录下的 file 文件,他需 要对 dir 目录以及 file 文件有什么权限(2 分)
A:file 的写权限和 dir 目录(以及一直向上到/目 录)的执行权限 B:只需要 file 的写权限 C:只需 file 的读和写权限 D:file 的写权限和 dir 目录(以及一直向上到/目 录)的写权限

3.3 默认情况下管理员创建了一个用户,就会在 ()目录下创建一个用户主目录(2 分)
A:/usr B:/home C:/root D:/etc
3.4 为脚本程序指定执行权限的命令参数是(2 分)
A:chmod +x filename.sh B:chown +x filename.sh C:chmod +w filename.sh D:chown +r filename.sh
3.5 如果执行命令 # chmod 746 file.txt , 那么该文件 的权限是?(2 分)
A:rwxr--rw- B:rw-r--r-- C:–xr—rwx D:jrwxr—r—
3.6 某文件的权限为:drw--r--r--,用数值形式表示 该权限,则该八进制数为(),该文件属性是() (2 分)
3.7 某个服务器有 a.sh 脚本,用户权限为 644,需 要执行什么命令,才可以执行./a.sh 命令(2 分)
3.8 唯一标识每一个用户的是用户的(2 分)
3.9 将以下权限翻译成数字,将数字权限用字母表 示(14 分)
rw-r-xr-- rw-r--r-- rwx--x--x rw------- rwxr--r-- rw-rw-r--
751 771 632 644 551 622 746 755
3.10 设置/home/user1/test 文件权限为所有者可读可 写可执行,所有组可读可写,其他所有账户可读, 并将该文件的所有者和所有组都修改为 root(3 分)
3.11 当用户 zabbix 对/testdir 目录有写和执行权限 时,该目录下的只读文件 file1 是否可修改和删 除?(3 分)
3.12 把 jacky 的密码设置为 123(3 分)
3.13 使用"ls -l /"以长格式查看根目录,写出引号内 容所代表的详细含义(4 分)
“dr-xr-xr-x.” 5 “root root” 4096 May 16 01:36 boot
3.14 当用户 mysql 对/data/DB 目录无读权限,但是 拥有写和执行权限,意味着能做哪些操作,无法做 哪些操作?(3 分)

四、进阶
4.1 如果某一天你误操作了"rm -rf *",会发生哪些 情况(3 分)
4.2 用命令行更改 config.txt 文件,把里面所有的 "name"更改为"address" (3 分)
4.3 用 awk 获取文件中第三行的倒数第二列字段(2 分)
4.4 删除 file.txt 文件中的空行(3 分)
4.5 删除/tmp 目录下所有 a 开头的文件(3 分) 五、翻译(每个 2 分)
5.1 [root@test-200 ~]# cd /rot -bash: cd: /rot: No such file or directory
5.2 [root@test-200 ~]# mdkir a -bash: mdkir: command not found
5.3 [root@test-200 ~]# mkdir a mkdir: cannot create directory ‘a’: File exists
5.4 [root@test-200 ~]# rm a rm: cannot remove ‘a’: Is a directory
5.5 [root@test-200 ~]# rm a.txt rm: remove regular empty file ‘a.txt’?
5.6 [root@test-200 ~]# cp /tmp/a.txt /root/a.txt cp: overwrite ‘/root/a.txt’?
5.7 [root@test-200 ~]# id www id: www: no such user
5.8 [test@test-200 /]$ cd /root bash: cd: /root: Permission denied
5.9 [root@test-200 /tmp]# cp -q a.txt c.txt cp: invalid option -- 'q'
5.10 [root@test-200 /home]# useradd test useradd: user 'test' already exists

你可能感兴趣的:(14day第二次笔试)