170412-常用分析命令汇总

常见操作命令汇总

linux命令

awk

1
2
awk -F "back_" '{print $2}' 159hq.log  | sort -nr   | more
awk -F "back_" '{print $2}' 159hq.log | sort -nr > out.txt

grep

1
2
3
4
5
6
7
8
9
10
grep -v 1540 159hq.log | grep  back_ | awk -F "back_" '{  if ( $2 < 0 ) {$2=100; } sum += $2; } END { print "sum = " sum; print "average = " sum/NR }'


grep -v 1540 159fs.log | grep back_ | awk -F "back_" '{ if ( $2 < 0 ) {$2=100; } sum += $2; } END { print "sum = " sum; print "average = " sum/NR }'


grep out.txt | awk -F "back_" '{ if ( $2 < 0 ) {$2=100; } sum += $2; } END { print "sum = " sum; print "average = " sum/NR }'


grep back_ out.txt | awk -F "back_" '{ if ( $2 < 0 ) {$2=100; } sum += $2; } END { print "sum = " sum; print "average = " sum/NR }'

ElasticSearch

  1. curl –user elastic:changeme -XGET ‘localhost:9200/_cat/health?v&pretty’

  2. curl -XGET “http://localhost:9200/_cluster/health?pretty=true"

  3. curl –user “elastic:els@)!(“ -XGET “http://localhost:9200/_cluster/health?pretty=true"

java

JVM

  1. /usr/local/java/jdk1.7.0_80/bin/jstat -gcutil 28106
  2. /usr/local/java/jdk1.7.0_80/bin/jstack 28106 > 1.out
  3. /usr/local/java/jdk1.7.0_80/bin/jcmd 73812 GC.class_histogram | more
  4. cat catalina.out |grep 信息结束耗时|awk -F’信息结束耗时:’ ‘{print $2}’|awk -F’毫秒’ ‘$1>1000{print $1}’|more
Your browser is out-of-date!

Update your browser to view this website correctly. Update my browser now

×