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
  • 4,893
  • 1
  • 19
  • 26
Michael
  • 6,995
  • 6
  • 37
  • 74

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
  • 4,893
  • 1
  • 19
  • 26