我写了一个简单的 在CentOS5.4下可用
输出了每个进程的id对应的cwd路径和exe路径
XML/HTML code
#!/bin/bash
pid=`ps axu | grep "java" | grep -v "grep" | awk '{print $2}'`
for evry_pid in ${pid}
do
exe_path=`ls -l /proc/${evry_pid} | grep "exe ->" | grep -v "grep" | awk '{print $
NF}'`
cwd_path=`ls -l /proc/${evry_pid} | grep "cwd ->" | grep -v "grep" | awk '{print $
NF}'`
echo ${evry_pid}:
echo "exe_path:"${exe_path}
echo "cwd_path:"${cwd_path}
done
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)