Pinned topic Create symbolic link with different path
I been looking on how to create symbolic link for my folder structure :
jailshell-3.2$ ln -s proj_shared BCD/from_HUB/test
-jailshell-3.2$ cd BCD/from_HUB/
programs_shared projects projects_old projects_shared_old test
-jailshell-3.2$ cd test
-jailshell: cd: test: No such file or directory
I want to create BCD/from_HUB/test as the link for /proj_shared. What I got is no such file directory. Could someone help me on this ?
ishields 2000001P5B988 Posts
Re: Create symbolic link with different path2011-06-28T13:07:15ZThis is the accepted answer. This is the accepted answer.See Learn Linux, 101: Create and change hard and symbolic links.
You should be able to accomplish what you want using
ln -s /proj_shared /BCD/from_HUB/test
SystemAdmin 110000D4XK2364 Posts
Re: Create symbolic link with different path2011-06-28T17:34:43ZThis is the accepted answer. This is the accepted answer.
If you do a ls -l of BCD/from_HUB it should show you what test is actually linking.
For example, on my laptop, I keep my user data on a separate partition from the system data. Then I link my /home directory into this structure. Here is what my root looks like when I do a listing:
drwxr-xr-x 2 root root 4096 2011-06-21 09:04 bin
drwxr-xr-x 3 root root 4096 2011-06-06 12:13 boot
drwxr-xr-x 2 root root 4096 2011-06-06 00:15 cdrom
drwxr-xr-x 4 root root 4096 2011-06-25 16:02 data
drwxr-xr-x 18 root root 3980 2011-06-28 08:19 dev
drwxr-xr-x 164 root root 12288 2011-06-28 12:22 etc
-rw-r--r-- 1 root root 1236 2011-03-02 08:42 GeoTrust_Global_CA.pem
lrwxrwxrwx 1 root root 10 2011-06-25 19:27 home -> /data/home
lrwxrwxrwx 1 root root 37 2011-06-06 00:21 initrd.img -> boot/initrd.img-2.6.32-32-generic-pae
drwxr-xr-x 21 root root 12288 2011-06-21 08:59 lib
drwx------ 2 root root 16384 2011-06-06 00:06 lost+found
drwxr-xr-x 3 root root 4096 2011-06-28 08:19 media
drwxr-xr-x 2 root root 4096 2010-04-23 05:11 mnt
drwxr-xr-x 10 root root 4096 2011-06-25 10:24 opt
dr-xr-xr-x 265 root root 0 2011-06-27 08:33 proc
drwx------ 30 root root 4096 2011-06-28 12:24 root
drwxr-xr-x 2 root root 4096 2011-06-21 08:59 sbin
drwxr-xr-x 2 root root 4096 2009-12-05 15:55 selinux
drwxr-xr-x 3 root root 4096 2011-06-08 09:49 srv
drwxr-xr-x 13 root root 0 2011-06-27 08:33 sys
drwxrwxrwt 54 root root 12288 2011-06-28 12:24 tmp
drwxr-xr-x 11 root root 4096 2011-06-08 09:38 usr
drwxr-xr-x 16 root root 4096 2011-06-06 01:14 var
lrwxrwxrwx 1 root root 34 2011-06-06 00:21 vmlinuz -> boot/vmlinuz-2.6.32-32-generic-pa
You can see that home points to /data/home. You can also see the links for initrd.img and vmlinuz.
The file system will allow you to make bogus links sometimes. It will also not clean itself up if you remove something that was linked. If you remove a link, it should not affect the original file (unless you do something that would be a recursive delete). Always remember that you provide the TARGET first, then the LINK. You may want to provide a full path in your link to make sure that it is correct:
ln -s /home /data/home
ln -s home /data/home
In the latter option, if I don't happen to be at the root (/), it may link to the wrong space.
See if any of that helps, and let us know if you fix it!