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 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


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.


Alternative titles

  1. Bash - create symlink in Linux
  2. Bash - create soft link in Linux
Donate to Dirask
Our content is created by volunteers - like Wikipedia. If you think, the things we do are good, donate us. Thanks!
Join to our subscribers to be up to date with content, news and offers.


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.

❤️💻 🙂