- 查找匹配的内容
# 查找 heitan-pro-admin.out 中包含 SysLogAspect 的行。-b查看非空行号
cat -b heitan-pro-admin.out | grep "c.a.h.mall.admin.aspect.SysLogAspect"
# 查找行
grep 'c.a.h.mall.admin.aspect.SysLogAspect' -nR heitan-pro-admin.out
# 查看文件最新的200条
tail -fn 200 nohup.out
# 查看文件从第280100行开始,显示1000行。即280100-281100
cat -b heitan-pro-admin.out | tail -n +280100 | head -n 1000
- 查看进程
# 查看所有进程
ps -ef
# 过滤包含java的进程
ps -ef |grep java
- 杀死进程
kill -9 [PID]
- 查找文件中间内容
cat input_file | head -n 20958238 | tail -n +20957300
- Jar启动
# 后台启动jar
nohup java -Duser.timezone=GMT+08 -jar xxx.jar &
# 后台启动jar,并指定输出文件 xxx.txt
nohup java -jar xxx.jar >xxx.txt &
- 通配符删除key
redis-cli keys "user*" | xargs redis-cli del
- 端口占用
#查看所有端口
netstat -ano
# 查看指定端口,最后一列为PID
netstat -ano|findstr "8081"
# 查看应用信息,PID,
tasklist|findstr "8808"
# 结束应用,PID
taskkill /pid 8008