linux命令

 

进入war包所在的目录,执行以下命令即可!

解压war包命令:jar -xvf **.war

 

 

查找日志命令

1、find . -name "file name"|xargs grep 'key word'

find . -name "chedai_manager.log"|xargs grep '资料审批失败'

 

2、grep --color 'time quantum' file name |grep --color 'key word'

grep --color '^16:2*' catalina.2017-06-08.log |grep --color '保存客户信息'

 

3、less 'fileName' | grep 'key word1' | grep 'key word2'

less chedai_server.log.20171019.1 | grep decodeContext | grep 99973

less chedai_server.log.20171019.1 | grep decodeContext | grep decodeContext

 

4、more

more -100 chedai_server.log 

按enter键显示文件下一行,按空格键便显示下一页,按 f键显示下一屏内容,按b键显示上一屏内容

5、

 

grep 后面带上-A -B -C 参数可以多显示几行内容

 

grep -A 5 可以显示匹配内容以及后面的5行内容

grep -B 5 可以显示匹配内容以及前面的5行内容

grep -C 5 可以显示匹配内容以及前后面的5行内容

 

$ cat size.txt

b124230

b034325

a081016

m7187998

m7282064

a022021

a061048

m9324822

b103303

a013386

b044525

m8987131

B081016

M45678

B103303

BADc2345

 

$ cat size.txt | grep 'a022021'

a022021

 

$ cat size.txt | grep 'a022021' -C 2

m7187998

m7282064

a022021

a061048

m9324822

 

$ cat size.txt | grep 'a022021' -B 2

m7187998

m7282064

a022021

 

$ cat size.txt | grep 'a022021' -A 2

a022021

a061048

 

 

 

6、访问量排名前十的ip地址

cat chedai_manager.log | cut -f1 -d " " | sort | uniq -c | sort -k 1 -n -r | head -10

 

7、页面访问量排名前十的URL

cat chedai_manager.log | cut -f4 -d " " | sort | uniq -c | sort -k 1 -n -r | head -10

 

8、查看404请求的占比

export total_line=`wc -l chedai_server_tomcat.log | cut -f1 -d " "` && export not_found_line=`awk '$6=='404'{print $6}' chedai_server_tomcat.log | wc -l` && expr $not_found_line \* 100 / $total_line

 

9、查某个时间段的日志

sed -n '/2019-01-10 17:17:00/,/2019-01-10 17:19:00/p' log.json | grep '10101725'

 

查看端口占用情况

 

 

1、ps -ef | grep 9010

 

 

 

2、ps -aux | grep tomcat

netstat -apn

进一步使用命令:ps -aux | grep java 或者直接:ps -aux | grep pid

 

3、查看nginx是否启动

ps -ef | grep nginx

未启动

 

4、启动nginx

执行 /usr/local/nginx/sbin/nginx(默认的安装目录),在执行ps -ef | grep nginx命令查看,master process是主线程,证明已启动

 

 

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值