Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

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?-
share|improve this question

2 Answers 2

up vote 1 down vote accepted

Use the equivalent:

readlink -f /proc/PID/cwd
share|improve this answer

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/

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

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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