Skip to content
Advertisement

create a symbolic link to multiple directory centos [closed]

I have currently created a symbolic link in var/www/html/lenova/ . It is currently linked to “assets” when I execute

   ll 

this is what gets displayed

    assets -> ../../../assets

I need to create another link to assets in a different folder var/www/html/dell.

so end results would be

   assets-> ../../../assets

when I execute

  ln -s assets ../../../assets

it displays

 ln: creating symbolic link `../../../assets/assets` to `assets`: File exists

How can I achieve the second symbolic link as-well? This folder needs to be shared by multiple projects

Advertisement

Answer

As Biffen stated, the arguments to ln are target first, then the link name. man ln shows:

SYNOPSIS
       ln [OPTION]... [-T] TARGET LINK_NAME   (1st form)
       ln [OPTION]... TARGET                  (2nd form)
       ln [OPTION]... TARGET... DIRECTORY     (3rd form)
       ln [OPTION]... -t DIRECTORY TARGET...  (4th form)

Assuming that ‘var/www/html/dell’ (the directory where you want the link) is the current working directory, you don’t even need to specify the link name as you want it to be the same as the target: ln -s ../../../assets Although, personally I am in the habit of specifying the destination directory: ln -s ../../../assets . If you really wanted to have the arguments in the order which you were using, you could use the -t option: ln -s -t . ../../../assets However, in that case you are specifying a directory, not the name of the link. To force the specifying the name of the link instead of a directory, use the -T option.

If you are not sure how a command works both the man, and info commands are available to provide information. It is not uncommon to use either an additional command window to show the man/help information while you are working, or to use job control to have the information available in the same command instance.

User contributions licensed under: CC BY-SA
10 People found this is helpful
Advertisement