a$ 行尾,匹配a
* 匹配0个或多个字符
[] 内的字符和序列,[1-5]=[12345]
\ 屏蔽原字符含义 \*\.pas
. 匹配单字符,不匹配0字符
pattern\{n\} 匹配前面pattern出现的次数。n为次数 a\{2\}b a出现2次,aab
pattern\{n,\} 匹配前面pattern出现的次数。次数最少为n a\{4,\}b a最少出现4次,aaaab aaaaab
pattern\{n,m\} 匹配前面pattern出现的次数。次数在n与m之间 a\{2,4\}b a出现2到4次
find ./ -nogroup -print 无组文件当前目录
find /var -mtime -5 -print 修改时间在5天内的
find /var -mtime +3 -print 修改时间在3天前的
find 'pwd' -newer "a" ! -newer "b" -print 比a新的比b旧的
find . -size +1000c -print 大于1000字节的
find . -size +10 -print 大于10个块的
find . -name "*.log" -mtime +5 -ok rm{} \; 查找5天前的*.log文件并删除
grep -c "2004" file 匹配行数
grep -n "2004" file 匹配行的行号和信息
grep -i "2004" file 匹配不区分大小写
grep -v "2004" file 匹配过滤
grep -c "2004-[1-12]" file 匹配1-12月
grep -c "^[^2004]" file 过滤开头为2004的
高深的awk $1变成了分隔符,awk一种编成语言
awk '{print $0}' file | tee file.out 输出文件file所有内容到屏幕和file.out文件
awk '{print $1"\t"$4}' file
awk 'BEGIN {print "NAME \n"} {print $1 "\t" $4}
END {"end"}' file
sed
ls -alF
cat -n file 行号
cat -b file 行号,略过空行
wc install.log -l 行 -w单词 -m/-c字符
1557 3106 62905 install.log
行 单词 字符
[root@linux ~]# cp 1 2
cp: overwrite `2'? y
[root@linux ~]# cat 2
1
mv 重命名文件
[root@linux ~]# cd ../../app/oracle
[root@linux oracle]#
[root@linux ~]# cd /app/oracle
[root@linux oracle]#
mkdir -p /1/2
rmdir 1 1为空目录
rm -r 目录和其内容
来自 “ ITPUB博客 ” ,链接:http://blog.itpub.net/10648374/viewspace-616610/,如需转载,请注明出处,否则将追究法律责任。
转载于:http://blog.itpub.net/10648374/viewspace-616610/