How to Create softlink with ln command on Linux

Symlink, also called softlink, is a symbolic path indicating the abstract location of another file. In addition, a softlink files has the same role as a Windows shortcut. In this post, i will show you on how to create softlink or symlink on linux server. This steps has been tested on linux CentOS 6.2 x86 server.

Some idea on to differentiates softlink and hard link :
A softlink can be used across files systems. A hard link increases the link count. When you create hard link you can remove the original file without losing data.

READ  How to Install and Configure Bind9 DNS on Ubuntu 11.10

To create symlink, simply run this command :

ln -s [target directory or file] [symlink shortcut]
[root@centos62 ~]# ln -s /public/index.html /home/ehowstuff/index.html

After creating the symbolic link above, /public/index.html will point to /home/ehowstuff/index.html.

2 Replies to “How to Create softlink with ln command on Linux”

  1. Hi !

    I wanna add an external storage to my linux 6.4 centos server ( ZPANEL ), not really familiar with linux disk formats and how to move the public/html files…

    How do i move the public/html files ( website files ) to point to my external drive ?

    I will format the external drive in wich structure ? ( i Know that Linux has plenties… and not really really clear for me as i mostly used pc’s and mac’s in the last 20 years… )

Leave a Reply

Your email address will not be published. Required fields are marked *