Categories: Ubuntu

How to Create Symbolic Links in Ubuntu 22.04

A symbolic link in Linux is similar to the Shortcuts in Microsoft windows like these symbolic links point to some other file placed in the Linux directory. There are two types of Symbolic links, one known as the soft links and the other known as hard links.

Soft links just point to some other file or directory in the file system of Ubuntu with the same name and path, whereas hard links are created with some new names, just like copies of original files.

In this blog, the method of creating the symbolic links in Ubuntu will be explored by demonstrating with some simple examples.

How
Sponsored
to Create Symbolic Links in Ubuntu 22.04?

In Ubuntu, by default, the ln utility is available, which links files/folders to some other files. The ln command utility is used to create the symbolic links by using the option of “-s”. The general syntax of using the ln command:

$ ln -s [OPTIONS] FILE LINK

In the above expressions, the user is supposed to provide the two parameters, one of File whose symbolic link is to be created and the other is Link to which the file is to be linked. If the user does not provide the Link, then Ubuntu will link the file with the present directory.

For a better understanding, following the above-mentioned general syntax, the symbolic link is being created for the File “MyCFile” using the command:

$ ln -s MyCFile MyLink

List down the contents of the directory to confirm the symbolic link:

$ ls -l MyLink

In the above command, “-l” option is used to display the link of the file.

Sponsored

How to Create Symbolic Links in Ubuntu?

Creating the symbolic links of the directories is similar to creating links of files. For example, we will create the symbolic link of /Home/Music to ~/my_music:

$ ln -s /Home/Music ~/my_music

How to Remove Symbolic Links in Ubuntu 22.04?

There are two ways either by deleting the symbolic link or unlink the symbolic link. To unlink the link of a file with its symbolic link, use the command:

$ unlink ~/my_music

Similarly, if you want to remove the symbolic link, then run the command:

$ rm MyLink

The link has been deleted from Ubuntu.

Conclusion

The “ln” command utility with its option of “-s” is used to create symbolic links of files and directories in Ubuntu 22.04. In this blog, different creations of symbolic links have been explored with the help of some examples.

Ubuntu Server Admin

Recent Posts

Canonical Releases Ubuntu 25.04 Plucky Puffin

The latest interim release of Ubuntu introduces “devpacks” for popular frameworks like Spring, along with…

2 days ago

Ubuntu 25.04 (Plucky Puffin) Released

Ubuntu 25.04, codenamed “Plucky Puffin”, is here. This release continues Ubuntu’s proud tradition of integrating…

3 days ago

Extended Security Maintenance for Ubuntu 20.04 (Focal Fossa) begins May 29, 2025

Ubuntu released its 20.04 (Focal Fossa) release 5 years ago, on March 23, 2020. As…

3 days ago

Ubuntu 20.04 LTS End Of Life – activate ESM to keep your fleet of devices secure and operational

Focal Fossa will reach the End of Standard Support in May 2025, also known as…

4 days ago

Ubuntu MATE 25.04 Release Notes

Ubuntu MATE 25.04 is ready to soar! 🪽 Celebrating our 10th anniversary as an official…

4 days ago

Ubuntu Weekly Newsletter Issue 887

Welcome to the Ubuntu Weekly Newsletter, Issue 887 for the week of April 6 –…

6 days ago