Linux查看进程运行完整路径的方法


=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.
参考链接:

=END=

, ,

《“Linux查看进程运行完整路径的方法”》 有 6 条评论

  1. 一个从/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

回复 a-z 取消回复

您的电子邮箱地址不会被公开。 必填项已用*标注