How to change relative symlinked path to “actual” one (in ranger or terminal)
Clash 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.
linux shell-script zsh symlink ranger
add a comment |
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.
linux shell-script zsh symlink ranger
Therealpath
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
add a comment |
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.
linux shell-script zsh symlink ranger
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
linux shell-script zsh symlink ranger
edited Nov 22 at 2:38
asked Nov 22 at 2:35
SdidS
1609
1609
Therealpath
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
add a comment |
Therealpath
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
add a comment |
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.
based on this I triedmap 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
add a comment |
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 .
add a comment |
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.
based on this I triedmap 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
add a comment |
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.
based on this I triedmap 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
add a comment |
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.
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.
answered Nov 22 at 2:45
Stephen Harris
23k24176
23k24176
based on this I triedmap 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
add a comment |
based on this I triedmap 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
add a comment |
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 .
add a comment |
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 .
add a comment |
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 .
In Ranger you can use the gl
and gL
commands. Type g
, then:
key command
L cd -r %f
l cd -r .
answered yesterday
laktak
706310
706310
add a comment |
add a comment |
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
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
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
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
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