linux常用命令技巧

查找目录dir中后缀为*.c和*.h的文件

 

用正则

find dir -type f -name '*.[ch]'

 

不用正则

find dir -type f -name '*.c' -o '*.h'

 

在目录a下建立目录b,而目录a可能不存在

mkdir -p a/b

 

查看dir目录下面所有txt文件中含有"string"串的总行数

 find dir -type f -name *.txt -exec grep "string" {} \; | wc -l

 

 

让所有执器同时执行同一道命令

建立好ssh, 设置环境变量SLAVES指定slaves的地址.

for slave in `cat $SLAVES`; do 
 ssh $slave $"${@// /\\ }" \
   2>&1 | sed "s/^/$slave: /"
done

 

 

 

slaves.sh scp hadoop@test162.sqa:/home/hadoop/.bash_profile ~/

slaves.sh scp hadoop@test162.sqa:/home/hadoop/.bashrc ~/

slaves.sh source ~/.bashrc

slaves.sh source ~/.bash_profile

 

转载地址:http://coderplay.iteye.com/blog/242679

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值