linux运维命令综合考试及参考答案20110605
来源:互联网 发布:洛丽塔航班 知乎 编辑:程序博客网 时间:2024/06/06 03:00
linux运维初级班课前综合考试及参考答案20110605
#########################################################
#《老男孩linux就业培训中心-初级班第七期课前考试及课上讲解
#LINUX命令实战抽查考试
#date:2011-06-05
#出题人:老男孩
#QQ:31333741 MAIL:oldboy521@hotmail.com
#blog: http://oldboy.blog.51cto.com
#psite: http://oldboy.cc(即将开放)
##########################################################
过程命令:
[root@http-server tmp]# cat ett.txt |tr "\n" "+"
1+2+3+4+5+6+7+8+9+10+[root@http-server tmp]# cat ett.txt |tr "\n" "+"|sed 's/\+$/\n/'
1+2+3+4+5+6+7+8+9+10
[root@http-server tmp]# cat ett.txt |tr "\n" "+"|sed 's/\+$/\n/'
1+2+3+4+5+6+7+8+9+10
[root@http-server tmp]# cat ett.txt |tr "\n" "+"|sed 's/\+$/=\n/'
1+2+3+4+5+6+7+8+9+10=
[root@http-server tmp]# cat ett.txt |tr "\n" "+"|sed 's/\+$/=\n/'|bc
(standard_in) 1: parse error
[root@http-server tmp]# cat ett.txt |tr "\n" "+"|sed 's/\+$/\n/'|bc
55
问题2:请获取www.baidu.com 的头(header)信息(考察curl命令)
1.即需要得到如下结果: 请给出命令。
HTTP/1.1 200 OK
Date: Sat, 04 Jun 2011 06:22:39 GMT
Server: BWS/1.0
Content-Length: 7492
Content-Type: text/html;charset=gb2312
Cache-Control: private
Expires: Sat, 04 Jun 2011 06:22:39 GMT
Set-Cookie: BAIDUID=80F597135ACBA8EF3B4B6F02EEE99C0D:FG=1; expires=Sat, 04-Jun-41 06:22:39 GMT; path=/; domain=.baidu.com
P3P: CP=" OTI DSP COR IVA OUR IND COM "
Connection: Keep-Alive
解答:
[root@http-server tmp]# curl -I www.baidu.com
HTTP/1.1 200 OK
Date: Sat, 04 Jun 2011 07:08:22 GMT
Server: BWS/1.0
Content-Length: 7492
Content-Type: text/html;charset=gb2312
Cache-Control: private
Expires: Sat, 04 Jun 2011 07:08:22 GMT
Set-Cookie: BAIDUID=17CDDACA35B51E142D1DA796972BEF3B:FG=1; expires=Sat, 04-Jun-41 07:08:22 GMT; path=/; domain=.baidu.com
P3P: CP=" OTI DSP COR IVA OUR IND COM "
Connection: Keep-Alive
[root@http-server tmp]# curl -I http://www.baidu.com
HTTP/1.1 200 OK
Date: Sat, 04 Jun 2011 07:08:30 GMT
Server: BWS/1.0
Content-Length: 7492
Content-Type: text/html;charset=gb2312
Cache-Control: private
Expires: Sat, 04 Jun 2011 07:08:30 GMT
Set-Cookie: BAIDUID=899D297BCA6475E94BE17E829B6D46BA:FG=1; expires=Sat, 04-Jun-41 07:08:30 GMT; path=/; domain=.baidu.com
P3P: CP=" OTI DSP COR IVA OUR IND COM "
Connection: Keep-Alive
2.请用一条命令 取得 字符串 HTTP/1.1 200 OK 请给出命令(这个是难点)。
解答:
[root@http-server tmp]# curl -I http://www.baidu.com|head -1
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
0 7492 0 0 0 0 0 0 --:--:-- --:--:-- --:--:-- 0
HTTP/1.1 200 OK
[root@http-server tmp]# curl -I http://www.baidu.com|grep 200
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
0 0 0 0 0 0 0 0 --:--:-- --:--:-- --:--:-- 0
curl: (52) Empty reply from server
[root@http-server tmp]# curl -I -s http://www.baidu.com|head -1
HTTP/1.1 200 OK
问题3:一个目录ett下 有3个文件 a,b,c
请打包整个ett目录,但是要排除C文件,即不打包c文件。(考察tar命令)
解答:见单独的tar排除打包总结
tar排除打包总结(19:54 2009-3-19)
man tar:
--exclude PATTERN
exclude files based upon PATTERN
-X, --exclude-from FILE
exclude files listed in FILE
测试准备:
cd /
mkdir -p /test/baoliu
mkdir -p /test/paichu
touch exceptlist;echo "paichu">exceptlist
测试开始:
1、--exclude参数
cd /
tar zcvf paichu.tar.gz ./test --exclude=test/paichu
./test/
./test/baoliu/
2、X 或--exclude-from参数
cd /
[root@oldboy /]# cat exceptlist
paichu
[root@oldboy /]# tar zcvfX paichuX.tar.gz /exceptlist ./test
./test/
./test/baoliu/
tar zcvf oldboy51-100916.tar.gz ./oldboy --exclude=oldboy/logs
本文出自 “老男孩的linux博客” 博客,请务必保留此出处http://oldboy.blog.51cto.com/2561410/584503
- linux运维命令综合考试及参考答案20110605
- linux运维初级班课前综合考试及参考答案20110529
- linux运维初级班shell脚本编程考试及参考答案20110523
- RHCE 考试题目及参考答案
- Linux试题及参考答案
- 大学英语四级考试试题及参考答案
- shell脚本编程考试及参考答案
- linux面试题及参考答案
- PMP认证考试练习题及参考答案(一)
- 桃源话六级考试参考答案
- Linux 命令综合
- 系统运维工程师面试题及参考答案
- 2010年山东省省直机关及直属单位考试录用公务员行政职业能力测验真题及参考答案
- 最新导游资格证考试综合模拟题及答案
- 2005年硕士研究生考试西医综合真题及答案
- 北理工Java技术与应用考试试题参考答案及点评(上)
- 北理工 Java 技术与应用考试试题参考答案及点评(下)
- 2010年4月25日公务员考试(十二省联考)行测真题及参考答案
- linux运维初级班课前综合考试及参考答案20110529
- Linux运维培训答学生问001
- 活学活用linux shell之-实现1+2+3...+100=?的7种方法分享
- 一个奇怪的生产环境配置ldap服务引起的故障及解决过程分享
- apache服务Forbidden 403问题精彩总结
- linux运维命令综合考试及参考答案20110605
- IOS Number 处理
- apache日志轮询技术(cronolog and rotatelogs)小结
- shell编程心得点滴分享!
- lamp环境实战操作建立完全属于自己的博客站点
- [实战运维小技巧]-解决perl命令执行或编译问题
- [实战运维小技巧]-telnet命令后无法退出的解决。
- linux上很方便的上传下载文件工具rz和sz
- mysql数据库批量插入数据shell脚本实现