0

pwd gives the absolute path to the current directory. Is there a way to give the absolute path of a directory relative to the current directory? (It's admittedly an almost non-problem.)

Normal pwd:

[/x/y/z]$ pwd
/x/y/z

Relative could be like:

[/x/y/z]$ pwd ../a/b 
/x/y/a/b
khrm
  • 5,363
  • 1
  • 22
  • 26
Michael
  • 7,407
  • 8
  • 41
  • 84

1 Answers1

3

You want absolute according to your question of a directory. Use realpath command:

realpath ../a/b

Will output absolute path./x/y/a/b

Relative path is what you are giving. ../a/b

khrm
  • 5,363
  • 1
  • 22
  • 26