Creating Symbolic Link (Ubuntu/Linux)

What is Symbolic Link?
Creates a link to a file or directory in linux or unix operating system.

Real world example
Your developer are jail to their home folder for SSH connection.
How to allow access to the code while enabling testing on the server?
Create a symbolic link from user home directory to Apache web root directory.

Syntax

# ln -s <real file or directory> <virtual file or folder>

Creating symbolic link for directory
Assuming user denny home directory at /home/denny and apache web root document path at /var/www
You will need root access to create symbolic link.

# sudo mkdir /home/denny/someproject

# sudo chown denny:developer /home/denny/someproject

# sudo ln -s /home/denny/someproject /var/www

# ls -ltr /var/www
total 8
-rw-r--r-- 1 root root 177 Sep 16 22:56 index.html
lrwxrwxrwx 1 root root  20 Oct  7 16:50 someproject -> /home/denny/someproject/

Creating symbolic link for file

# sudo touch /home/denny/realfile

# sudo chown denny:developer /home/denny/realfile

# sudo ln -s /home/denny/realfile /var/www/realfile

# ls -ltr /var/www
total 8
-rw-r--r-- 1 root root 177 Sep 16 22:56 index.html
lrwxrwxrwx 1 root root  20 Oct  7 16:50 someproject -> /home/denny/someproject/
lrwxrwxrwx 1 root root  20 Oct  7 16:54 realfile -> /home/denny/realfile

To delete symbolic link
Issue the rm (remove) command

# rm /var/www/someproject

# rm /var/www/realfile