I was fiddling around with symbolic links in my unix box and realised how cool they were. Basically symbolic links (or symlinks) create a virtual copy of the master file. This virtual copy has almost 100% of the master’s functionalities and characteristics (you’ll need to play around with the owner and file permissions sometimes though), and the really good thing about symlinks is that if you update the master files, your symlinks automatically get updated too!
Here’s the Code for Creating a Symbolic Link (Symlink)
ln -s [TARGET DIRECTORY OR FILE] ./[SHORTCUT]
ln -s /home/user/public_html ./user
This points a symbolic link “./user” to /home/user/public_html”. If you want to create symlinks to the directory’s contents instead, add an asterisk to the end, like so “directory/*”. That will tell Unix to create the symbolic links to point to everything contained in the folder.
Here’s the Code for Removing or Deleting a Symbolic Link (Symlink)
You can also use unlink, like this:
One thing I’ve realised is that you shouldn’t leave a trailing slash, because that denotes that the target is a directory, and Unix will complain.