Go Back   Web Hosting UK Forums | Linux Windows Dedicated Server and cPanel VPS Hosting Forum > Web Hosting and Domains > Shared & Reseller Hosting

Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 11-02-2008, 08:20 AM
Junior Member
 
Join Date: Oct 2008
Posts: 10
Default Find current working directory with PID....

While monitoring the Linux server with command called top, it will display the PID of processes.

The following command will display all the PID for any particular process name.
Process name will be http,mysqld, exim etc.
----------------------------
[root@server ~]# ps aux | grep {process name}
----------------------------

To find out current working directory of a PID 2640

------------------------
[root@sweden ~]# ls -l /proc/2640/cwd
lrwxrwxrwx 1 root root 0 Nov 2 08:00 /proc/2640/cwd -> /home/alsoft123/public_html/photos-screensaver
------------------------
According to the output given in the above example the current directory for the process 2640 is “/home/alsoft123/public_html/photos-screensaver” and the username is “alsoft123”.

Another command to locate the working directory for the process is
----------------------------
[root@server ~]# pwdx 2640
----------------------------

While monitoring the server using top command, if the process is constantly holding an upper position and the load on the server is increasing, then it will be helpful to locate the directory for that process on the server. Once you get a directory, you can find out a username on the server who is causing this problem.
You can use kill command to stop that running process at that time.
Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is On
Trackbacks are On
Pingbacks are On
Refbacks are On
Forum Jump


All times are GMT. The time now is 12:33 AM.
Copyright 2002-2007 WebHosting.uk.com. All rights reserved.
Web Hosting UK Forum