Alcott
Alcott

Reputation: 18585

get a bash's cwd

If I open up 2 terminals in Ubuntu, via ps u I can see 2 bash's pid.

My problem is from one terminal, how can I know the bash's cwd in the other terminal?

Upvotes: 0

Views: 4552

Answers (2)

crw
crw

Reputation: 685

The pwdx command prints the current working directory of each given process ID.

Example from Solaris (believe Ubuntu also has the command):-

$ cd /tmp
$ pwdx $$
22281:  /tmp

Upvotes: 2

Some programmer dude
Some programmer dude

Reputation: 409166

You can check

/proc/<pid>/cwd

Upvotes: 4

Related Questions