linux常用命令---002
1.查看某个端口 // lsof -i :16729 |grep 16729 --color
2.sed ‘:a ; N;s/\n/ / ; t a ; ‘ file1 > file2 // 多行转1行,有字符,速度快
3.awk BEGIN{RS=EOF}‘{gsub(/\n/," ");print}‘ file1 > file2 //多行转1行,有字符
4. ./b_d.sh /opt/online_deploy-niu/hosts-niu/adserver "source /etc/profile && source /opt/apps/flume_ng/conf/flume-env.sh && /opt/apps_install/flume_ng-1.3.0/bin/flume-ng agent -n weblog-agent -c /opt/apps_install/flume_ng-1.3.0/conf -f /opt/apps_install/flume_ng-1.3.0/conf/flume.conf"
5. ./b_d.sh /opt/online_deploy-niu/hosts-niu/adserver " ps aux|grep flume_ng-1.3.0|grep -v grep |awk ‘{print \$2}‘|xargs kill -9 "
6.for i in `cat mum-new-mpost`;do ssh $i "ps -ef |grep flume";echo $i;sleep 2;echo;echo ;done
7.linux 替换命令
要把 test.txt文件里的所有 desc 字符串替换为 helloworld,可用这样的命令
sed "s#desc#helloworld#g" test.txt >test.txt.temp
mv test.txt.temp test.txt
8.算总大小
du -s countinfo.log.2014-12-18-* |awk ‘{sum += $1}; END{printf sum/1000/1000}‘
郑重声明:本站内容如果来自互联网及其他传播媒体,其版权均属原媒体及文章作者所有。转载目的在于传递更多信息及用于网络分享,并不代表本站赞同其观点和对其真实性负责,也不构成任何其他建议。