0

There are many ways to create and remove the symbolic link but there is no website how to use this I think.

joshua9900@JY-NAM:~/a$ tree
.
├── b
│   └── c
│       └── home_link -> /home/joshua9900/a/
└── c_link -> /home/joshua9900/a/b/c

4 directories, 0 files

I made the simple example. Both home_link and c_link point each other. So I'm not sure, but I thought how to use was something like cd <symbolic link>.

joshua9900@JY-NAM:~/a$ ll
total 0
drwxr-xr-x 1 joshua9900 joshua9900 4096 Feb 25 14:28 ./
drwxr-xr-x 1 joshua9900 joshua9900 4096 Feb 25 14:27 ../
drwxr-xr-x 1 joshua9900 joshua9900 4096 Feb 25 14:27 b/
lrwxrwxrwx 1 joshua9900 joshua9900   22 Feb 25 14:28 c_link -> /home/joshua9900/a/b/c/
joshua9900@JY-NAM:~/a$ cd c_link
joshua9900@JY-NAM:~/a/c_link$ ll
total 0
drwxr-xr-x 1 joshua9900 joshua9900 4096 Feb 25 14:29 ./
drwxr-xr-x 1 joshua9900 joshua9900 4096 Feb 25 14:27 ../
lrwxrwxrwx 1 joshua9900 joshua9900   16 Feb 25 14:29 home_link -> /home/joshua9900/a/

We are at ~/a/c_link and there is the other symbolic link home_link which points the directory where we started.

I understand I can reach the directory the symbolic link points by using cd <symbolic link>. But if I keep moving back and forth between two (or more), this happens.

joshua9900@JY-NAM:~/a/c_link/home_link/c_link/home_link/c_link$

And the above directory is equal to ~/a/b/c. This is why I'm not sure cd <...> is the right way to use a symbolic link.

Thank you.

I've searched and tried the several Linux commands.

Kusalananda
  • 333,661
  • 1
    So, I'd say this is as expected. You all for "the right way to use" something - but use for what? Nothing about what you do seems wrong, but it also seems pointless, because you don't tell us what you want to achieve. – Marcus Müller Feb 25 '23 at 08:00
  • Maybe you want cd -P. Investigate cd -L vs cd -P (and pwd -L vs pwd -P). – Kamil Maciorowski Feb 25 '23 at 11:55

0 Answers0