LINUX系统管理  实验报告二
专业
计算机应用技术
班级
20应用1班
姓名
学号
成绩
操作题(写出相应的命令):
1.以 root用户身份登录到 Linux 系统字符界面,指出RHEL中默认使用的是什么Shell默认的 Shell 命令提示符为[root@localhost~]#,指出命令提示符中每个部分的具体含义。
答:默认的Shell是Bash,root代表当前用户,localhost代表计算机名,~代表用户主目录,#代表当前用户是系统管理员。
grep命令有什么用
2. 执行命令查看用户当前所在的目录。
答:[root@localhost ~]# pwd
3. 显示当前目录下所有文件的详细信息(包含隐藏文件),在 Linux系统中,隐藏文件的标识是什么? 在显示的文件详细信息中,第一组数的第1个字符代表文件类别,ed"“1”“e”"b”分别代表的是哪种类别的文件?
答:[root@localhost ~]# ls -al
隐藏文件以“.”开头,“-”代表普通文件,“d”代表目录,“l”代表链接文件,“c”代表字符设备,“b”代表块设备。
4.显示/etc/inittab 文件的详细信息.
答:[root@localhost ~]# ls -lh /etc/inittab
5. 显示/dev 目录中所有以 sd 开头的文件的详细信息。
答:[root@localhost ~]# ls -lh /dev/sd*
6. 在root用户的家目录里创建一个名为testl 的目录.
答:[root@localhost ~]# mkdir test1
7.在testl 目录中创建一个名为templ的空文件。
答:[root@localhost ~]# cd /root/test1
 [root@localhost test1]# touch temp1
8. 将文件 templ 复制一份进行备份,仍然保存在/root/testl/目录下,备份的文件名为templ.bak.
答:[root@localhost test1]# cp temp1 temp1.bak
9,将文件 templ.bak 改名为temp.bak,并将 temp.bak 移动到/tmp/目录下.
答:[root@localhost test1]# mv temp1.bak /tmp/temp.bak
10.将/root/test1/目录强制删除.
答:[root@localhost ~]# rm -rf /root/test1/
11.用cat 命令查看 /etc/sysconfig/network-scripts/ifcfg-ethO 文件的内容,注意用Tab键补齐。
答:[root@localhost ~]# cat /etc/sysconfig/network-scripts/ifcfg-eth0
12.分别用 more、less 命令分屏查看/etc/passwd文件的内容。
答:[root@localhost ~]# more /etc/passwd
   [root@localhost ~]# less /etc/passwd
13. 查看 /etc/passwd 文件的前 10 行内容.
答:[root@localhost ~]# head /etc/passwd
14.查看/etc/passwd 文件的后5行内容。
[root@localhost ~]# tail -5 /etc/passwd
15.统计/etc目录中扩展名是*.conf的文件的个数。
答:[root@localhost ~]# find /etc/ -name "*.conf" -type f | wc -l
16.查/dev目录中所有以sd开头的文件。
答:[root@localhost ~]# find /dev -name "sd*" -type b
17.查/etc 目录下以 http 开头的文件,将结果保存到/tmp/fhttp.file"文件中。
答:[root@localhost ~]# find /etc -name "http*" > /tmp/fhttp.file
18. 在/boot目录中查大小超过1024 KB 而且文件名以 init 开头的文件。
答:[root@localhost ~]# find /boot -size +1024k -name "init*"
19.在/etc/passwd 文件中查包含“root”字符串的行.
答:[root@localhost ~]# grep root /etc/passwd
20,在/etc/httpd/f文件中查所有以“#”开头的行。
答:[root@localhost ~]# grep "^#" /etc/httpd/f
21. 查/etc/httpd/f文件中所有不是以“#”开头的行。
答:[root@localhost ~]# grep -v "^#" /etc/httpd/f
22. 查所有属于普通用户student的文件。
答:[root@localhost ~]# find /home -user student
23.为/etc/httpd/f文件在root用户家目录中创建一个名为 httpd的软链接。
答:[root@localhost test]# ln -s /etc/httpd/f /root/httpd
24,创建一个名为wecl 的命令别名,统计/etc/httpd/f文件中不是以#开头的并且不是空白行的行数。
答:[root@localhost~]# alias wecl=“grep -v "^#" /etc/httpd/f | gerp “^$””
25.到find命令的命令文件路径。
[root@localhost~]# which find
26.查看 find 命令的帮助信息。
答:[root@localhost ~]# find --help
27.查看grep命令的帮助手册。
答:[root@localhost ~]# man grep
28.查看历史命令。
答:[root@localhost ~]# history3
15 wc /f
16 wc -1 /etc/passwd
17 history 3
29,查/rootinstaill.log 中包含字符串 lib 的行,并复制到/文件中。
答:[root@localhost ~]# grep "lib" /root/install.log > /
30.将/etc/passwd文件中前10行的内容复制到/root/文件中。
答:[root@localhost ~]# head /etc/passwd > /root/

版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系QQ:729038198,我们将在24小时内删除。