Please whitelist cPanel in your adblocker so that you’re able to see our version release promotions, thanks!

The Community Forums

Interact with an entire community of cPanel & WHM users!

PID running directory

Discussion in 'General Discussion' started by alifazman, Dec 28, 2010.

  1. alifazman

    alifazman Active Member

    Joined:
    Sep 27, 2010
    Messages:
    39
    Likes Received:
    0
    Trophy Points:
    56
    Location:
    Malaysia
    Hi All.

    How do I check the working directory for example PID :1234. Is it any way to detect in through ssh command /cPanel

    Thanks ya!!
     
  2. cPanelJared

    cPanelJared Technical Analyst

    Joined:
    Feb 25, 2010
    Messages:
    1,835
    Likes Received:
    21
    Trophy Points:
    143
    Location:
    Houston, TX
    cPanel Access Level:
    Root Administrator
    You can get information about a PID, including its current working directory, by looking in the corresponding subdirectory in /proc. Each running PID has its own directory in /proc. Simply use the ls command to view the contents of /proc/$PID (where $PID is replaced with an actual valid PID).
     
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
  3. garrettp

    garrettp Well-Known Member
    PartnerNOC

    Joined:
    Jun 18, 2004
    Messages:
    312
    Likes Received:
    0
    Trophy Points:
    166
    cPanel Access Level:
    DataCenter Provider
    Similarly and perhaps a bit more readable, you can get the cwd of a process using it's PID through lsof. It also will provide information about currently open (or listening) connections, sockets, and open files.

    Code:
    lsof -p <pid>
     
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
  4. JeffP.

    JeffP. Well-Known Member

    Joined:
    Sep 28, 2010
    Messages:
    164
    Likes Received:
    15
    Trophy Points:
    68
    Yet another way is via the "readlink" command:

    # readlink /proc/`pgrep cpsrvd`/cwd
    /usr/local/cpanel/base
     
  5. alifazman

    alifazman Active Member

    Joined:
    Sep 27, 2010
    Messages:
    39
    Likes Received:
    0
    Trophy Points:
    56
    Location:
    Malaysia
    Hello all,

    Thanks for all those information. It helps me ;)

    Happy new year to all ;D
     
Loading...

Share This Page

  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice