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


This article has not been checked!

LKB | Created: 02/04/2020 | Version: 0 | Language: EN | Rating: 0 | Outdated: False | Marked for deletion: False

Author: Wim Peeters - Keskon GmbH & Co. KG


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! 

About the Author

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 in different European countries and different European languages. He writes knowledge base articles to solve IT problems and publishes them on the Lubby Knowledge Platform where he is one of the most important contributors and the main developer.

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!