LKBEN10988: Howto create a symbolic link for a directory or a file


Symptom

You need to create a symbolic link to a directory or a file

Cause

none

Solution

Working with symbolic links is very usefull under linux. Lots of people have problems using them. To create a symbolic link on a directory you use the following command:

ln -s TheDirectory TheLink

Here you will create a symbolic link with the name "TheLink" to a directory called "TheDirectory". Please note that the symbolic link should not be there before!

To create a symbolic link for a file you use:

ln -s TheFile TheLink

Which is exactly the same. When the link is there before, you can use the option -f (=force) to create the link anyway.

Please note that a symbolic link is not the same as a hard link! 

Disclaimer:

The information provided in this document is intended for your information only. Lubby makes no claims to the validity of this information. Use of this information is at own risk!

About the Author

Author: Wim Peeters - Keskon GmbH & Co. KG

Wim Peeters is electronics engineer with an additional master in IT and over 30 years of experience, including time spent in support, development, consulting, training and database administration. Wim has worked with SQL Server since version 6.5. He has developed in C/C++, Java and C# on Windows and Linux. He writes knowledge base articles to solve IT problems and publishes them on the Lubby Knowledge Platform.