Shell

^a   行首,匹配a

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/

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值