pwdx is supposed to print out the current working directory of a process given a process id.

Normally this looks something like:

$ sudo pwdx 1
1: /

$ pwdx $$
5251: /home/foo

One one machine I have it always returns the same gibberish string

$ pwdx 1
1: H?l$?L?|$?H?-

$ pwdx 24535
24535: H?l$?L?|$?H?-

$ pwdx $$
24351: H?l$?L?|$?H?-
link|improve this question

80% accept rate
feedback

2 Answers

up vote 1 down vote accepted

Use the equivalent:

readlink -f /proc/PID/cwd
link|improve this answer
feedback

Intresting. pwdx is really simple, code-wise; it just resolve the 'cwd' symlink target in /prod/pid

What do you get from this?

ls -l /proc/$$/cwd

Also, what distribution/architecture are you on? Default character set? Here's a link to the source if you want to try building your own. You shouldn't need to do anything outside of "make".

http://procps.sourceforge.net/

link|improve this answer
distribution = it's Ubuntu server 10.04.2 x86_64; I suspect the character set is utf8 but I don't know how to check; /proc/[pid]/cwd seems to work correctly – ʞɔıu Jul 19 '11 at 14:35
actually it's 9.04 – ʞɔıu Jul 19 '11 at 15:13
feedback

Your Answer

 
or
required, but never shown

Not the answer you're looking for? Browse other questions tagged or ask your own question.