How to change relative symlinked path to “actual” one (in ranger or terminal)

The name of the pictureThe name of the pictureThe name of the pictureClash Royale CLAN TAG#URR8PPP











up vote
0
down vote

favorite












What is actual path? Consider folder A in the file system and a symlinked B to it. Consider currently in ranger (or terminal) inside a sub-directory within B such as /home/B/sub1/sub2 which is in fact /another_but_actual_path/A/sub1/sub2. What I want is to have a tool/command/script which convert the relative path to the actual path. I mean while pwd shows /home/B/sub1/sub2, I want to access the path /another_but_actual_path/A/sub1/sub2.



p.s. I tried readlink but it couldn't give me the actual path.



p.s. I don't know if so called actual path has a name or not.










share|improve this question























  • The realpath command?
    – Stephen Harris
    Nov 22 at 2:38










  • @StephenHarris, yep!
    – SdidS
    Nov 22 at 2:38










  • @StephenHarris, if you can please provide the answer with some more useful information to get approved or feel free to remove the whole question.
    – SdidS
    Nov 22 at 2:40














up vote
0
down vote

favorite












What is actual path? Consider folder A in the file system and a symlinked B to it. Consider currently in ranger (or terminal) inside a sub-directory within B such as /home/B/sub1/sub2 which is in fact /another_but_actual_path/A/sub1/sub2. What I want is to have a tool/command/script which convert the relative path to the actual path. I mean while pwd shows /home/B/sub1/sub2, I want to access the path /another_but_actual_path/A/sub1/sub2.



p.s. I tried readlink but it couldn't give me the actual path.



p.s. I don't know if so called actual path has a name or not.










share|improve this question























  • The realpath command?
    – Stephen Harris
    Nov 22 at 2:38










  • @StephenHarris, yep!
    – SdidS
    Nov 22 at 2:38










  • @StephenHarris, if you can please provide the answer with some more useful information to get approved or feel free to remove the whole question.
    – SdidS
    Nov 22 at 2:40












up vote
0
down vote

favorite









up vote
0
down vote

favorite











What is actual path? Consider folder A in the file system and a symlinked B to it. Consider currently in ranger (or terminal) inside a sub-directory within B such as /home/B/sub1/sub2 which is in fact /another_but_actual_path/A/sub1/sub2. What I want is to have a tool/command/script which convert the relative path to the actual path. I mean while pwd shows /home/B/sub1/sub2, I want to access the path /another_but_actual_path/A/sub1/sub2.



p.s. I tried readlink but it couldn't give me the actual path.



p.s. I don't know if so called actual path has a name or not.










share|improve this question















What is actual path? Consider folder A in the file system and a symlinked B to it. Consider currently in ranger (or terminal) inside a sub-directory within B such as /home/B/sub1/sub2 which is in fact /another_but_actual_path/A/sub1/sub2. What I want is to have a tool/command/script which convert the relative path to the actual path. I mean while pwd shows /home/B/sub1/sub2, I want to access the path /another_but_actual_path/A/sub1/sub2.



p.s. I tried readlink but it couldn't give me the actual path.



p.s. I don't know if so called actual path has a name or not.







linux shell-script zsh symlink ranger






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Nov 22 at 2:38

























asked Nov 22 at 2:35









SdidS

1609




1609











  • The realpath command?
    – Stephen Harris
    Nov 22 at 2:38










  • @StephenHarris, yep!
    – SdidS
    Nov 22 at 2:38










  • @StephenHarris, if you can please provide the answer with some more useful information to get approved or feel free to remove the whole question.
    – SdidS
    Nov 22 at 2:40
















  • The realpath command?
    – Stephen Harris
    Nov 22 at 2:38










  • @StephenHarris, yep!
    – SdidS
    Nov 22 at 2:38










  • @StephenHarris, if you can please provide the answer with some more useful information to get approved or feel free to remove the whole question.
    – SdidS
    Nov 22 at 2:40















The realpath command?
– Stephen Harris
Nov 22 at 2:38




The realpath command?
– Stephen Harris
Nov 22 at 2:38












@StephenHarris, yep!
– SdidS
Nov 22 at 2:38




@StephenHarris, yep!
– SdidS
Nov 22 at 2:38












@StephenHarris, if you can please provide the answer with some more useful information to get approved or feel free to remove the whole question.
– SdidS
Nov 22 at 2:40




@StephenHarris, if you can please provide the answer with some more useful information to get approved or feel free to remove the whole question.
– SdidS
Nov 22 at 2:40










2 Answers
2






active

oldest

votes

















up vote
1
down vote



accepted










The standard Linux "coreutils" package contains a command realpath.



This will follow any and all symbolics links for the named path, and return the "real" path associated with it.



So:



$ mkdir -p /tmp/foo/bar
$ ln -s /tmp/foo $HOME/foo
$ realpath $HOME/foo
/tmp/foo
$ realpath $HOME/foo/bar
/tmp/foo/bar
$ realpath $HOME/foo/bar/baz
/tmp/foo/bar/baz


We can see that the link $HOME/foo is being replaced by the real path of /tmp/foo.



The last entry need not exist, but all intermediate points must.



$ realpath $HOME/foo/bar/baz/qux
realpath: '/home/sweh/foo/bar/baz/qux': No such file or directory


That's because there is no baz directory.






share|improve this answer




















  • based on this I tried map gR cd "$(realpath $(pwd))" in ranger config (rc.conf) but it dident' work. It might be due to something with ranger and how it represent the path but any clue?
    – SdidS
    Nov 22 at 2:54

















up vote
1
down vote













In Ranger you can use the gl and gL commands. Type g, then:



key command
L cd -r %f
l cd -r .





share|improve this answer




















    Your Answer








    StackExchange.ready(function()
    var channelOptions =
    tags: "".split(" "),
    id: "106"
    ;
    initTagRenderer("".split(" "), "".split(" "), channelOptions);

    StackExchange.using("externalEditor", function()
    // Have to fire editor after snippets, if snippets enabled
    if (StackExchange.settings.snippets.snippetsEnabled)
    StackExchange.using("snippets", function()
    createEditor();
    );

    else
    createEditor();

    );

    function createEditor()
    StackExchange.prepareEditor(
    heartbeatType: 'answer',
    convertImagesToLinks: false,
    noModals: true,
    showLowRepImageUploadWarning: true,
    reputationToPostImages: null,
    bindNavPrevention: true,
    postfix: "",
    imageUploader:
    brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
    contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
    allowUrls: true
    ,
    onDemand: true,
    discardSelector: ".discard-answer"
    ,immediatelyShowMarkdownHelp:true
    );



    );













     

    draft saved


    draft discarded


















    StackExchange.ready(
    function ()
    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f483346%2fhow-to-change-relative-symlinked-path-to-actual-one-in-ranger-or-terminal%23new-answer', 'question_page');

    );

    Post as a guest















    Required, but never shown

























    2 Answers
    2






    active

    oldest

    votes








    2 Answers
    2






    active

    oldest

    votes









    active

    oldest

    votes






    active

    oldest

    votes








    up vote
    1
    down vote



    accepted










    The standard Linux "coreutils" package contains a command realpath.



    This will follow any and all symbolics links for the named path, and return the "real" path associated with it.



    So:



    $ mkdir -p /tmp/foo/bar
    $ ln -s /tmp/foo $HOME/foo
    $ realpath $HOME/foo
    /tmp/foo
    $ realpath $HOME/foo/bar
    /tmp/foo/bar
    $ realpath $HOME/foo/bar/baz
    /tmp/foo/bar/baz


    We can see that the link $HOME/foo is being replaced by the real path of /tmp/foo.



    The last entry need not exist, but all intermediate points must.



    $ realpath $HOME/foo/bar/baz/qux
    realpath: '/home/sweh/foo/bar/baz/qux': No such file or directory


    That's because there is no baz directory.






    share|improve this answer




















    • based on this I tried map gR cd "$(realpath $(pwd))" in ranger config (rc.conf) but it dident' work. It might be due to something with ranger and how it represent the path but any clue?
      – SdidS
      Nov 22 at 2:54














    up vote
    1
    down vote



    accepted










    The standard Linux "coreutils" package contains a command realpath.



    This will follow any and all symbolics links for the named path, and return the "real" path associated with it.



    So:



    $ mkdir -p /tmp/foo/bar
    $ ln -s /tmp/foo $HOME/foo
    $ realpath $HOME/foo
    /tmp/foo
    $ realpath $HOME/foo/bar
    /tmp/foo/bar
    $ realpath $HOME/foo/bar/baz
    /tmp/foo/bar/baz


    We can see that the link $HOME/foo is being replaced by the real path of /tmp/foo.



    The last entry need not exist, but all intermediate points must.



    $ realpath $HOME/foo/bar/baz/qux
    realpath: '/home/sweh/foo/bar/baz/qux': No such file or directory


    That's because there is no baz directory.






    share|improve this answer




















    • based on this I tried map gR cd "$(realpath $(pwd))" in ranger config (rc.conf) but it dident' work. It might be due to something with ranger and how it represent the path but any clue?
      – SdidS
      Nov 22 at 2:54












    up vote
    1
    down vote



    accepted







    up vote
    1
    down vote



    accepted






    The standard Linux "coreutils" package contains a command realpath.



    This will follow any and all symbolics links for the named path, and return the "real" path associated with it.



    So:



    $ mkdir -p /tmp/foo/bar
    $ ln -s /tmp/foo $HOME/foo
    $ realpath $HOME/foo
    /tmp/foo
    $ realpath $HOME/foo/bar
    /tmp/foo/bar
    $ realpath $HOME/foo/bar/baz
    /tmp/foo/bar/baz


    We can see that the link $HOME/foo is being replaced by the real path of /tmp/foo.



    The last entry need not exist, but all intermediate points must.



    $ realpath $HOME/foo/bar/baz/qux
    realpath: '/home/sweh/foo/bar/baz/qux': No such file or directory


    That's because there is no baz directory.






    share|improve this answer












    The standard Linux "coreutils" package contains a command realpath.



    This will follow any and all symbolics links for the named path, and return the "real" path associated with it.



    So:



    $ mkdir -p /tmp/foo/bar
    $ ln -s /tmp/foo $HOME/foo
    $ realpath $HOME/foo
    /tmp/foo
    $ realpath $HOME/foo/bar
    /tmp/foo/bar
    $ realpath $HOME/foo/bar/baz
    /tmp/foo/bar/baz


    We can see that the link $HOME/foo is being replaced by the real path of /tmp/foo.



    The last entry need not exist, but all intermediate points must.



    $ realpath $HOME/foo/bar/baz/qux
    realpath: '/home/sweh/foo/bar/baz/qux': No such file or directory


    That's because there is no baz directory.







    share|improve this answer












    share|improve this answer



    share|improve this answer










    answered Nov 22 at 2:45









    Stephen Harris

    23k24176




    23k24176











    • based on this I tried map gR cd "$(realpath $(pwd))" in ranger config (rc.conf) but it dident' work. It might be due to something with ranger and how it represent the path but any clue?
      – SdidS
      Nov 22 at 2:54
















    • based on this I tried map gR cd "$(realpath $(pwd))" in ranger config (rc.conf) but it dident' work. It might be due to something with ranger and how it represent the path but any clue?
      – SdidS
      Nov 22 at 2:54















    based on this I tried map gR cd "$(realpath $(pwd))" in ranger config (rc.conf) but it dident' work. It might be due to something with ranger and how it represent the path but any clue?
    – SdidS
    Nov 22 at 2:54




    based on this I tried map gR cd "$(realpath $(pwd))" in ranger config (rc.conf) but it dident' work. It might be due to something with ranger and how it represent the path but any clue?
    – SdidS
    Nov 22 at 2:54












    up vote
    1
    down vote













    In Ranger you can use the gl and gL commands. Type g, then:



    key command
    L cd -r %f
    l cd -r .





    share|improve this answer
























      up vote
      1
      down vote













      In Ranger you can use the gl and gL commands. Type g, then:



      key command
      L cd -r %f
      l cd -r .





      share|improve this answer






















        up vote
        1
        down vote










        up vote
        1
        down vote









        In Ranger you can use the gl and gL commands. Type g, then:



        key command
        L cd -r %f
        l cd -r .





        share|improve this answer












        In Ranger you can use the gl and gL commands. Type g, then:



        key command
        L cd -r %f
        l cd -r .






        share|improve this answer












        share|improve this answer



        share|improve this answer










        answered yesterday









        laktak

        706310




        706310



























             

            draft saved


            draft discarded















































             


            draft saved


            draft discarded














            StackExchange.ready(
            function ()
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f483346%2fhow-to-change-relative-symlinked-path-to-actual-one-in-ranger-or-terminal%23new-answer', 'question_page');

            );

            Post as a guest















            Required, but never shown





















































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown

































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown






            Popular posts from this blog

            How to check contact read email or not when send email to Individual?

            Bahrain

            Postfix configuration issue with fips on centos 7; mailgun relay