xmanman

导航

 

1、经常用于linux中查看日志作用:

sed -n '/2017-07-01T09:30:51/,/2017-07-01T10:00:51/p'  flume-http.errlog|less

2、查看端口

netstat -lntp

3、 展示文件时间排序前10条

ls -lt|head -n 10

4、替换某个文件内容的命令

//将百度官网替换成新浪官网

sed -i "s/www.baidu.com/www.xinlang.com/g" /app/123.txt

sed -i "s/sinks.mongosink1.collection = log$yesdate/sinks.mongosink1.collection = log$todate/g" flume-mongo-kafka-41414-newCluster.conf

5.grep方式 直接杀进程(支持远程杀进程)

ps -ef|grep Dflume|grep -v grep|cut -c 9-15|xargs kill -9

ssh weihu@172.16.12.83 "ps -ef|grep mongo|grep -v grep|grep 10000|cut -c 9-15|xargs kill -9"

6.将grep查找出来的文件或者文件夹删掉,这个只能查文件名称

ls | grep 小明 | xargs rm -rf

7.使用ll 命令来过滤的话,需要截取出文件名称

ll | grep 13:55 |cut -c 49- |xargs rm -rf

 

posted on 2017-07-03 17:07  xmanman  阅读(165)  评论(0编辑  收藏  举报