1、显示当前系统上root、fedora或user1用户的默认shell;答:需要找到3个字符串,需要用到“或”命令,所以使用egrep。找到后cut再次筛选出我们需要显示的用户默认的shell。2、找出/etc/rc.d/init.d/functions文件中某单词后面跟一组小括号的行,形如:hello();答:3、使用ech..
分类:
编程语言 时间:
2016-09-04 00:18:51
阅读次数:
351
1、显示当前系统上root、fedora或user1用户的默认shell;[root@C7-1~]#useraddfedora#新建用户fedora
[root@C7-1~]#useradduser1#新建用户user1
[root@C7-1~]#egrep‘^(root|fedora|user1)\>‘/etc/passwd|cut-d:-f1,7#由于(root|fedora|user1)是扩展表达式,所以要使用egrep..
分类:
其他好文 时间:
2016-09-02 16:07:52
阅读次数:
173
1、显示当前系统上root、fedora或user1用户的默认shell;grep-E‘^root|fedora|allan:‘/etc/passwd|cut-d:-f1,7#显示root,allan默认shellroot:/bin/bashallan:/bin/bash2、找出/etc/rc.d/init.d/functions文件中某单词后面跟一组小括号的行,形如:hello();egrep‘[_[:alpha:]]+..
分类:
其他好文 时间:
2016-08-30 23:09:59
阅读次数:
364
1、显示当前系统上root、fedora或user1用户的默认shell;]#egrep"^root\b|^user1\b|^fedora\b"/etc/passwd|cut-d:-f1,72、找出/etc/rc.d/init.d/functions文件中某单词后面跟一组小括号的行,形如:hello();]#grep"[[:alpha:]]\+()"/etc/rc.d/init.d/functions3、使用echo命令..
分类:
其他好文 时间:
2016-08-30 22:53:12
阅读次数:
266
grep:GlobalsearchREgularexpressionandPrintouttheline. 作用:文本搜索工具,根据用户指定的“模式”对目标文本逐行进行匹配检查;打印匹配到的行; 模式:由正则表达式字符及文本字符所编写的过滤条件; REGEXP:由一类特殊字符及文本字符所编写的模式,其中有些字符不表..
分类:
其他好文 时间:
2016-08-30 16:13:47
阅读次数:
222
1、显示当前系统上root、fedora或user1用户的默认shell;egrep"^(root|user1|fedora)"/etc/passwd|cut-d:-f72、找出/etc/rc.d/init.d/functions文件中某单词后面跟一组小括号的行,形如:hello();egrep"^[[:alpha:]]+\(\)"/etc/rc.d/init.d/functions#小括号必须转义,因为()..
分类:
系统相关 时间:
2016-08-30 14:55:35
阅读次数:
406
本周作业内容:1、复制/etc/skel目录为/home/tuser1,要求/home/tuser1及其内部文件的属组和其它用户均没有任何访问权限。第一种方式:
[root@liu/]#chmod-Rgo=---/home/tuser1
[root@liutuser1]#ls-l/home/tuser1/
总用量4
-rw-------.1rootroot478月2500:01issue
第二种方式..
分类:
编程语言 时间:
2016-08-29 13:23:41
阅读次数:
269
书中精彩总结(P32)表1-3:egrep的元字符总结匹配单个字符的元字符元字符匹配对象.点号匹配单个任意字符[...]字符组匹配单个列出的字符[^...]排除型字符组匹配打嗝未列出的字符\char转义字符若char是元字符,或转义序列无特殊含义是,匹配char对应的普通字符提供计数功能的元字符..
分类:
其他好文 时间:
2016-08-26 23:04:47
阅读次数:
179
1、复制/etc/skel目录为/home/tuser1,要求/home/tuser1及其内部文件的属组和其它用户均没有任何访问权限。[root@mageeduhome]#cp-r/etc/skel//home/tuser1[root@mageeduhome]#chmod-Ru-r,o-rtuser1/[root@mageeduhome]#lltotal40drwx------.2bashbash4096Aug1312:01bashdrwx--..
分类:
系统相关 时间:
2016-08-26 15:46:05
阅读次数:
355
#!/bin/bash if [ $# -ne 1 ] then echo "Usage: $0 filename"; exit -1 fi filename=$1 egrep -o "\b[[:alpha:]]+\b" $filename | \ awk '{ count[$0]++ } END{ ...
分类:
系统相关 时间:
2016-08-26 12:12:47
阅读次数:
258