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 Apache2, PHP and MySQL 5.6 on Ubuntu 14.04

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 comments
  1. stephane
    stephane
    May 21, 2014 at 9:42 pm

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

    Reply
Leave a Reply

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

SiteGround.com

A world leading hosting company that provides fully-managed innovative and secure solutions, suitable for hosting small to medium-sized websites

Built on the best available technologies combined with Google Cloud for strong redundancy and application availability. Backed by skilled experts to address web security threats, a devops team to create advanced custom security solutions, and 24/7 sysadmins to watch over the platform. This powerful, hands-on approach makes your sites faster, safer, and easier to manage. Starting from only $3.95/mo.

TRY FREE

* up to 30 days money back guarantee