|
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}'
9.更改时间
date -s "20120827 15:04:00"
10.查看linux是什么系统
cat /etc/issue
|
|
|