=Start=
缘由:
通过ps及top命令查看进程信息时,一般只能查到相对路径,查不到的进程的详细信息,如绝对路径等。这时,我们需要通过以下的方法来查看进程的详细信息。
参考解答:
Linux在启动一个进程时,系统会在/proc下创建一个以PID命名的文件夹,在该文件夹下会有我们的进程的信息,其中包括一个名为exe的文件记录了可执行文件的绝对路径 和 一个名为cwd的文件记录了当前的工作目录,通过 ls -l 命令即可查看。
/proc/PID/exe Link to the executable of this process. /proc/PID/cwd Link to the current working directory.
参考链接:
- http://lovesoo.org/view-processes-running-linux-full-path-method.html
- http://unix.stackexchange.com/questions/141342/proc-pid-cwd-is-there-a-posix-equivalent
- http://serverfault.com/questions/66363/environment-variables-of-a-running-process-on-unix
- http://www.cnblogs.com/itech/archive/2012/08/29/2662526.html
- http://www.ibm.com/developerworks/cn/linux/l-proc.html
- https://en.wikipedia.org/wiki/Procfs
- http://www.tldp.org/LDP/Linux-Filesystem-Hierarchy/html/proc.html
=END=
《 “Linux查看进程运行完整路径的方法” 》 有 6 条评论
Linux系统性能指标
https://yq.aliyun.com/articles/6047
http://man7.org/linux/man-pages/man5/proc.5.html
一个从/proc文件系统中dump运行中进程的内存
https://github.com/fuhry/linux-memory-dumper
用Golang写的解析 /proc 信息的parser
https://github.com/c9s/goprocinfo
理解Linux进程
https://github.com/tobegit3hub/understand_linux_process
用Golang写的psutil
https://github.com/shirou/gopsutil
用Python写的跨平台的进程和系统工具模块
https://github.com/giampaolo/psutil
用Flask和psutil写的系统信息的Web展示功能
https://github.com/Jahaja/psdash
/proc文件系统的说明
https://www.mjmwired.net/kernel/Documentation/filesystems/proc.txt
https://github.com/lilijreey/what-is-in-proc
http://www.linuxjournal.com/article/8381
ps/top/free/pgrep/pkill/vmstat/…等命令的源码
http://procps.sourceforge.net/
https://gitlab.com/procps-ng/procps
Qualys发布了关于Procps-ng的审计报告:
https://www.qualys.com/2018/05/17/procps-ng-audit-report-advisory.txt
同时提供修复补丁:
https://www.qualys.com/2018/05/17/procps-ng-audit-report-patches.tar.gz
Security Advisory by RedHat and Debian:
https://access.redhat.com/security/cve/cve-2018-1124
https://security-tracker.debian.org/tracker/CVE-2018-1124
Linux下用C语言实现#根据进程名打印进程ID
`/proc/$pid/comm`
https://phoxis.org/2013/09/13/find-process-ids-of-a-running-process-by-name/
https://stackoverflow.com/questions/8166415/how-to-get-the-pid-of-a-process-in-linux-in-c
https://www.kernel.org/doc/Documentation/filesystems/proc.txt
https://linux.die.net/man/5/proc
Linux 最大进程数
https://www.cnblogs.com/pangguoping/p/5792075.html
Understanding the difference between pid_max, ulimit -u and thread_max
https://unix.stackexchange.com/questions/136854/understanding-the-difference-between-pid-max-ulimit-u-and-thread-max
Linux最大线程数限制
https://blog.csdn.net/u013673976/article/details/51788566
https://www.cyberciti.biz/tips/howto-linux-increase-pid-limits.html
https://stackoverflow.com/questions/9361816/maximum-number-of-processes-in-linux
Is it normal for PID’s to be over 65535?
https://serverfault.com/questions/647815/is-it-normal-for-pids-to-be-over-65535