Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

We have two paths. First one is directory, second either dir or file.

/a/b/c and /a/d/e.txt

Relative path from first path to second will be: ../../d/e.txt

How to get it in linux terminal?

PS: For those who ask "what is use case?" - creating lots of relative symlinks (just as an example)

share|improve this question

migrated from stackoverflow.com May 13 '10 at 4:30

This question came from our site for professional and enthusiast programmers.

This should not have been migrated. –  Roger Pate May 13 '10 at 4:52
It should have been closed as a duplicate. –  Dennis Williamson May 13 '10 at 10:19

1 Answer 1

Looks like this type of problem was discussed in


share|improve this answer
Thank you - saves me looking up the discussion. –  Jonathan Leffler May 13 '10 at 4:49

Your Answer


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