Find out current working directory of a process

pwdx $(pgrep command)
The pwdx command reports the current working directory of a process or processes.
Sample Output
 $ pwdx $(pgrep bash)
2716: /home/user
 $ pwdx $(pgrep Xorg)
1414: Permission denied

2013-02-01 08:33:15

6 Alternatives + Submit Alt

What Others Think

Good afternoon. It's been a long time since I found such a useful service that can increase the efficiency of my sales department. Here is the 7 Best LinkedIn prospecting tools [url=][/url] Octopus CRM is one of the top tools for prospecting on LinkedIn in 2022. It really works, so I recommend everyone to try this service.
Asuma · 22 weeks and 1 day ago
This is a good choice for the programmers specifically those who have doubts about the programming code as this is a really helpful page they always try to discuss about various topics regarding the programming.">design own diamond engagement ring Keep on sharing more posts
Kaitlyn · 9 weeks and 4 days ago

What do you think?

Any thoughts on this command? Does it work on your machine? Can you do the same thing with only 14 characters?

You must be signed in to comment.

What's this? is the place to record those command-line gems that you return to again and again. That way others can gain from your CLI wisdom and you from theirs too. All commands can be commented on, discussed and voted up or down.

Share Your Commands

Stay in the loop…

Follow the Tweets.

Every new command is wrapped in a tweet and posted to Twitter. Following the stream is a great way of staying abreast of the latest commands. For the more discerning, there are Twitter accounts for commands that get a minimum of 3 and 10 votes - that way only the great commands get tweeted.


Subscribe to the feeds.

Use your favourite RSS aggregator to stay in touch with the latest commands. There are feeds mirroring the 3 Twitter streams as well as for virtually every other subset (users, tags, functions,…):

Subscribe to the feed for: