【视频笔记】效率提升亿点点,最好用的命令使用技巧
常规用法:
ps -ef | grep java 拷贝java进程id
jstat -gc 7907 (进程id)
等价用法:
jstat -gc `pgrep java`
pgrep 命令根据关键字查询进程号。 反引号作用是将命令结果原地替换,然后作为参数传递到jstat命令中

当pgrep返回多个结果时,可用用 pgrep -f 参数,筛选
pgrep -f math

column -t 对齐

查看进程实例对象个数
jmap -histo `pgrep -f math` |head -n10
watch 会不断重复执行有关命令
-d 用于输出2次内容的不同之处,用于关注变化部分
watch -d 'jstat -gcutil 7907 |column -t'

bc用于计算
[service@localhost arthas]$ echo '3628224/1024/1024' |bc
3
[service@localhost arthas]$ echo 3628224 | awk '{print $1/1024/1024}'
3.46014
[service@localhost arthas]$ expr 3628224 / 1024
3543
[service@localhost arthas]$ echo $((3628224 /1024 /1024))
3

jmap -histo `pgrep -f math` |head -n6 |numfmt --to=iec --invalid=ignore --field=3


浙公网安备 33010602011771号