Results 1 to 2 of 2
Hi,
First of all actually I want to find out the working directory of a process. This can be easily found by
Code:
pwdx pid
But to find the pid ...
- 06-17-2009 #1Just Joined!
- Join Date
- Jun 2009
- Posts
- 2
How to find user only process for a spesific program
Hi,
First of all actually I want to find out the working directory of a process. This can be easily found by
But to find the pid of the process I have to always check it out via ps. Now i make some research and i found this piece bash code:Code:pwdx pid
It shows directly the working directory of the process. But now the problem comes, if there is other users who are using this command i get the error:Code:echo COMMAND | xargs -ixxx ps -C xxx -o pid= | xargs -ixxx ls -l /proc/xxx/cwd
4531: Permission denied
This is caused because other users are also running the same process.
Now here comes the question, how can i modify the above code that it shows only process from a specific user( in other words the working directory)
Thanks in advance
- 06-17-2009 #2Just Joined!
- Join Date
- Jun 2009
- Posts
- 2
Ok i found another way, i've used awk and for loop, this code do the same job
Code:for pid in $(ps -u USERNAME | grep PROGRAMNAME | awk '{print $1;}'); do pwdx $pid ; done


Reply With Quote