EN
Bash - create symbolic link in Linux
6
points
In this short article, we would like to show how to create symbolic link in Linux using Bash (or any line command).
Quick solution:
ln -s /path/to/file link_name
# or:
ln -s /path/to/directory link_name
Where -s
parameter means symbolic link creation.
Note:
/path/to/file
or/path/to/directory
can be changed to anything (other link, device, etc.).
Practical example
In this section, we will show how to create symbolic link to directory.
$ cd /var/www/html
$ ln -s /opt/redmine/redmine-4.1.1/public/ redmine
Testing:
root@debian:/var/www/html# ls -al
total 16
drwxr-xr-x 4 root root 4096 Sep 12 21:30 .
drwxr-xr-x 3 root root 4096 Jun 3 22:13 ..
-rw-r--r-- 1 root root 0 Sep 9 23:38 index.html
lrwxrwxrwx 1 root root 34 Sep 12 21:30 redmine -> /opt/redmine/redmine-4.1.1/public/
Conclusion: we can see
redmine
links to/opt/redmine/redmine-4.1.1/public/
directory.