Create a symbolic link of Directory in Ubuntu [closed]

Below is my code for creating a symlink of directory:

sudo ln -s /usr/local/nginx/conf/ /etc/nginx

I already created the directory /etc/nginx. I just want the contents of the source directory to be in the contents of the target dir. When I execute the code that is in /etc/nginx is a directory called “conf”. In that dir is the contents I want but in the wrong location. So, why did it put a directory in the target folder?

Create symbolic directory

How do you make a symbolic link from a directory to a directory? I’ve scoured google for a straight forward answer but all examples are either for file links or kind of hand wave around how you make a

create a symbolic link to multiple directory centos

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 a

How to create relative symbolic link in mac OS? [closed]

How to create a relative symbolic link that would always point to original folder two levels up? I would like to create a computer-independent alias that would work on any machine, provided that the o

linux copy symbolic link [closed]

How do I copy a symbolic link from one directory to another? ls -ls file1.txt file2.txt files -> /mnt/iscsi-nfs-share/faulttracker-files what I’m looking to do is copy files symbolic link into ano

Create symbolic link from find

I’m trying to create a symbolic link (soft link) from the results of a find command. I’m using sed to remove the ./ that precedes the file name. I’m doing this so I can paste the file name to the end

How do I selectively create symbolic links to specific files in another directory in LINUX?

I’m not exactly sure how to go about doing this, but I need to create symbolic links for certain files in one directory and place the symbolic links in another directory. For instance, I want to link

How to copy contents from a directory and not symbolic link? [closed]

on a directory cp -rvf dir . copies the symbolic links and not actual contents. src is copied to module/hal/ . |– comm | `– alchemist.c |– module | `– hal | `– src | `– comm -> ../comm `– sr

Determine if Windows process has privilege to create symbolic link

I want to programmatically determine if the current user (or process) has access to create symbolic links. In Windows (Vista and greater), one cannot create a symbolic link without the SeCreateSymboli

Facing error : Cannot create symbolic link

I m trying to install openSSL but its giving me error while extracting openssl-1.0.1g.tar: Error: D:/openssl-1.0.1g.tar_3: Cannot create symbolic link D:/openssl-1.0.1g/apps/md4.c A required privilege

Symbolic link to a non existing file [closed]

I tried to create a symbolic link to a non existing file ln -s non_existing_file.txt $HOME/dir1/dir2/my_symbolic_link then I tried to write something in the non existing file using the symbolic link

Answers

This is the behavior of ln if the second arg is a directory. It places a link to the first arg inside it. If you want /etc/nginx to be the symlink, you should remove that directory first and run that same command.

That’s what ln is documented to do when the target already exists and is a directory. If you want /etc/nginx to be a symlink rather than contain a symlink, you had better not create it as a directory first!

In script is usefull something like this:

if [ ! -d /etc/nginx ]; then ln -s /usr/local/nginx/conf/ /etc/nginx > /dev/null 2>&1; fi

it prevents before re-create “bad” looped symlink after re-run script