0

Can I make shortcut like in Win, which will be visible in folder from (almost) every program (cli like mc and gui - any open file dialog) that will "move" me to specific directory, not related to location of shortcut? SO when I will go up (after using this) I don't want to get back, but go up.

Example:

/home/jarek/some_link -> /srv/httpd/htdocs/projekt

I'm using link, and I want check some other files in htdocs, click up (or cd ..) and ordinary soft link take my back to ~ and I want to htdocs.

ps. I saw posts about differences in pwd and /bin/pwd and nice to know that I can check where I really am, but this doesn't solve my problem.

  • @Tigger, read the question more closely (especially the line I quoted in my answer). – Wildcard Jan 9 '18 at 23:39
1

...ordinary soft link take my back to ~ and I want to htdocs.

What you want is the -P option to cd.

To read up on how the current working directory is kept track of, both for the shell and for any process, see:

However, for purposes of traversing symlinks, the important thing to understand is that the actual named path that you pass to cd becomes your "current working directory." In your example, pwd would show /home/jarek/some_link, and as you correctly note, cd .. would take you to /home/jarek, not to /srv/httpd/htdocs.

If instead you run pwd -P, you will see /srv/httpd/htdocs/projekt. And if you run cd -P . and then cd .., you will be in /srv/httpd/htdocs as you want. Running cd -P .. will also work fine; I've just checked.

Run help cd and help pwd for full information.

  • Thanks, it should help witch console, and what about GUI open dialog? btw, it still isn't modification of link. Does it mean that you can't do that type of link in Linux? – Jarek Jan 11 '18 at 17:55

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.