How to Create Symbolic Link in Linux?

How to Create Symbolic Link in Linux?

Hello friends, welcome to inet70. In this topic, we can create and use symbolic links to display and show any five paths without moving the file or folder. Before getting more information about symbolic links, let's understand what they are.

What is a Symbolic Link?

A symbolic link, also known as a symlink or soft link, is a tool used to create a path location between folders or directories. It allows us to store copies of files or folders in different locations.

How to Use Symbolic Links on Linux?

To create an internal path or copy files, you can use symbolic links in the terminal. Follow these steps:

  1. Make a shortcut of the file or folder on any location.
  2. Use the "ln" command on the terminal and include the "-s" or "symbolic" option.

Use the given command to create a symbolic link on Linux.

$ ln -s [Source_Directory_Path] [SymbolicLink_Destination_Path]

In this Command at [Source_Directory_Path] you can use the file location thair shown as a Symbolic Link Folder and at the [SymbolicLink_Destination_Path] You can put the output Directory for Folder Symbolic Link.

Example: Let's say we have an "inet70" folder available on the desktop. To create a symbolic link of this directory in the "home" folder, use the following command:

ln -s /home/ubuntu/Desktop/inet70 /home/ubuntu/
Create Symbolic Link on Linux Example

After executing the command, you will see the symbolic link folder in the home directory.

Note: The second image shows that the "inet70" folder is located at /home/ubuntu/, but this folder is linked to the target directory.

You can follow a similar process for files as well.