strace的应用

查看程序在运行中读写哪些文件:
strace -e open 程序 2>&1
寻找不能打开某个文件的原因:
strace -e open,access 2>&1 | grep 文件

查看正在运行的程序:
strace -p 程序ID

分析所花时间:
strace -c -p 程序ID

分析网络连接状况:
strace -e poll,select,connect,recvfrom,sendto nc www.baidu.com 80