Create a symbolic link of directory in Ubuntu
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.
Symbolic Links in Ubuntu Recursively link to files in one directory to another
Try this:
cd /var/www/xxx
for a in * ; do ln -s /var/www/xxx/$a /var/www/yyy/$a ; done
This will symlink all the files one-by-one.
It's a bit messy, though. If you have multiple sites sitting on the same codebase but requiring different configuration files, you should really teach your framework how co-ordinate that for you. It's not really difficult, but does require more thinking than I can spare for this reply, I'm sorry.
Create symbolic link of a folder
You can create it like this without the need of creating something before:
ln -s /usr/local/var /var/run
How to create a link to a directory on linux
Symbolic or soft link (files or directories, more flexible and self documenting)
# Source Link
ln -s /home/jake/doc/test/2000/something /home/jake/xxx
Hard link (files only, less flexible and not self documenting)
# Source Link
ln /home/jake/doc/test/2000/something /home/jake/xxx
More information: man ln
/home/jake/xxx
is like a new directory. To avoid "is not a directory: No such file or directory" error, as @trlkly comment, use relative path in the target, that is, using the example:
cd /home/jake/
ln -s /home/jake/doc/test/2000/something xxx
Create symbolic link with sub-directories
Assuming both /usr/local/nfs/etc
and /usr/local/gemini/application
exist as directories, your command
ln -s /usr/local/nfs/etc /usr/local/gemini/application
creates a symbolic link etc
in /usr/local/gemini/application
referencing /usr/local/nfs/etc
.
If you want to see application
and its content in /usr/local/nfs/etc
you have to swap the command line arguments:
ln -s /usr/local/gemini/application /usr/local/nfs/etc
This will create a symbolic link application
in /usr/local/nfs/etc
.
See man ln
Related Topics
How to Rename Multiple Files Beginning with a Unix Timestamp - Imapsync Issue
Why Doesn't Perf Report Cache Misses
How to Add .So File to the Java.Library.Path in Linux
How to Set a Global Nofile Limit to Avoid "Many Open Files" Error
Trying to Statically Link Boost
How to Build and Compile Cross Platform Xamarin Apps on Linux
Replace Text Between Two Strings in File Using Linux Bash
Selecting a Linux I/O Scheduler
Understanding Load Average VS. CPU Usage
How to Find Ports Opened by Process Id in Linux
Limit on File Name Length in Bash
Gcc Compilation "Cannot Compute Suffix of Object Files: Cannot Compile"