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:
xxxxxxxxxx
1
ln -s /path/to/file link_name
2
3
# or:
4
5
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.).
In this section, we will show how to create symbolic link to directory.
xxxxxxxxxx
1
$ cd /var/www/html
2
3
$ ln -s /opt/redmine/redmine-4.1.1/public/ redmine
Testing:
xxxxxxxxxx
1
root@debian:/var/www/html# ls -al
2
total 16
3
drwxr-xr-x 4 root root 4096 Sep 12 21:30 .
4
drwxr-xr-x 3 root root 4096 Jun 3 22:13 ..
5
-rw-r--r-- 1 root root 0 Sep 9 23:38 index.html
6
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.