strace

How should strace be used?

纵然是瞬间 提交于 2019-11-26 02:15:51
问题 A colleague once told me that the last option when everything has failed to debug on Linux was to use strace. I tried to learn the science behind this strange tool, but I am not a system admin guru and I didn’t really get results. So, What is it exactly and what does it do? How and in which cases should it be used? How should the output be understood and processed? In brief, in simple words , how does this stuff work? 回答1: Strace Overview strace can be seen as a light weight debugger. It

linux查看进程占用cpu、内存、io信息

廉价感情. 提交于 2019-11-26 00:17:21
1、查看CPU信息 ps ps aux | sort -k3nr |head -n 10 上面显示按照按照消耗CPU前10排序的进程。 top 命令然后界面输入大写的P,进程按照CPU消耗动态排序 strace 使用strace跟踪进程系统调用 strace -c -p 2532 2、查看内存信息 ps ps aux | sort -k4nr |head -n 10 上面显示按照按照消耗内存前10排序的进程。 top 命令然后界面输入大写的M,进程按照内存消耗动态排序 pmap 使用pmap命令查看进程的内存状态,以及内存映射 pmap -xq 2750 3、查看磁盘IO信息 iotop iostat iostat 1 10 4、查看网络信息 iptraf-ng 或者 iptraf 使用iptraf-ng命令查看网卡流量情况,以及应用端口网络流量情况 iptraf-ng eth0 注意: iptraf-ng和iptraf命令系统一般默认不安装,使用之前需要通过yum -y intall iptraf安装 netstat 使用netstat查看监听端口及进程 netstat -tunlp 使用netstat命令查看主机路由信息 netstat -rn 来源: 51CTO 作者: lq2011 链接: https://blog.51cto.com/liuqun/2049656