Difference between Relative and Absolute symlinks
Last Updated :
09 Oct, 2020
Symbolic Link (aka symlink) is a file that doesn't store any data, but rather reference to another file or directory in the form of absolute or relative path. Strictly speaking, A symbolic link isn't necessarily a file, but it is rather file system object. A symlink doesn't occupy any space (0 bytes of space occupied), but rather exists as special entry in file table. Symbolic link for many operations will behave as if operating directly on target file. During creation of Symbolic links, type is associated with final symbolic link, which is used to access the target. Symbolic link can be of two types
Relative or
Absolute. In this article we will learn what are differences between these two types of symbolic links, and would also learn to create them.
Types of Symbolic Links :
There are two types of symbolic links : Absolute symbolic links, and Relative symbolic links. These are explained as following below.
1. Relative Symbolic Link :
An relative symbolic link is an symbolic link, whose target has relative path. An relative path is path that is based on Current Working Directory. The path of target file/folder will be calculated according to the current path of symlink. Therefore, there is no definite path so as to say. As the path is always computed accordingly to current location of symlink. For example, let's assume a symbolic link (file) has following target path.
..\Apples
Symbolic link described above is relative symbolic link. The reason is because it has the .. (double period) in its path which is for denoting parent of directory in which filer currently resides. This makes is dynamic as file could be anywhere, but it will look for target file in a file named apples in its parent directory. Therefore, target path becomes depended on path of file.
It should be noted that double period ( .. ) is not literal TWO periods in succession, but rather directory operand referencing parent directory.
Creating Relative Symbolic Links :
For creating a relative symbolic link on windows, we would be using mklink command. Syntax for creating relative symbolic link is as follows :
mklink new_Link_name Target_path
And the target path should be relative. In the following example we will be creating a file symbolic link named Floss having its target file (named
test.jpg) inside one of the subdirectory (named
Bin) of its parent directory.
Example :

In order to create symbolic links on windows, command prompt (
cmd) must be executed with elevated privilege's
2. Absolute Symbolic Links :
An absolute symbolic link is symbolic link, whose target is absolute/full path. An absolute path is path that exists on its own and has no dependency on Current Working Directory. The path of target file/folder will always be the same, regardless of location of symlink. For example, let's assume symbolic link (file) has following target path.
C:\Program Files\Windows\Leon.txt
Symbolic link described above is an absolute symbolic link. Reason is because it contains hardcoded Target path. Due to which regardless of location of symbolic link, lookup for the target file would be for only one path.
Creating absolute Symbolic Link :
For creating a absolute symbolic link on windows, we would be using mklink command. Syntax for creating relative symbolic link is as follows :
mklink new_Link_name full_Target_path
The full_target_path should be full path (including drive specifier) to target file. In the following example we will be creating a file symbolic link named
Lesson.txt having a the target file at location
C:\Users\French\Workshop.txt
Example :

NOTE :
It should be noted that the type of symbolic link (relative/absolute) does not depend on way source path (New_Link_Path) was provided. Therefore new link path could be provided relative or absolute according to preference, as it would have no impact in the type of symbolic link. It's the
Target path which is determinant of the type.
Similar Reads
Difference between Relative and Absolute Deadline of Real-time Task 1. Relative Deadline : The time interval between the start of the task and the completion of the real-time task is known as Relative deadline. It is basically the time interval between arrival and corresponding deadline of the real-time task. If the arrival time of task is 't' and corresponding dead
2 min read
Difference between Hard Link and Soft Link The file system in Unix-like operating systems, such as Linux and macOS, provides a variety of methods for creating hyperlinks between files and directory paths. These linkages work as suggestions or references to the source file, ensuring the organization of data and enterprise management within th
3 min read
Difference between link and anchor Tags The HTML language is the most basic component of web development. If you are a beginner to web development, and learning about HTML then you must have discovered the "link" and "a" tag. These two entities <link> and <a>, are used for some kind of linking so if you are confused between th
4 min read
Difference between URL and Link When you are searching for information on the web, you frequently use terms like URL and link. Also, these two terms can be explained in terms of one another, as they are not defined in the same way. While a URL (Uniform Resource Locator) is the address of a resource on the web, a Link (or Hyperlink
5 min read
Difference Between URL and URI In Web browsers and Internet connections, it is important to understand the difference between a Uniform Resource Identifier (URI) and a Uniform Resource Location (URL). Both URIs and URLs are pointers to things like web pages, images, documents, or other online content. However, they have distincti
7 min read