查找目录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 [email protected]:/home/hadoop/.bash_profile ~/
slaves.sh scp [email protected]:/home/hadoop/.bashrc ~/
slaves.sh source ~/.bashrc
slaves.sh source ~/.bash_profile