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.
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.