Bash - create symbolic link in Linux

6 points
Created by:

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/or/directory link_name

Where -s parameter means symbolic link creation.

Note: /path/to/file/or/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.

ln -s /opt/redmine/redmine-4.1.1/public/ redmine


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.


Bash - create symbolic link in Linux
Native Advertising
Get your tech brand or product in front of software developers.
For more information Contact us
Dirask - we help you to
solve coding problems.
Ask question.

❤️💻 🙂