how to create a symbolic link in linux
How to create a symbolic link to a directory in Ubuntu?
Linux provides us a way with which we can create symbolic links or symlinks, that issimply pointing to another file or folder on your machine.
Now let's understand what symbolic links actually mean and how to make use of it.
Symbolic links in simple terms mean advanced shortcuts. A symbolic link that you create will appear to be the same as the original file or folder which it is pointing to, even though it's simply a link.
For example, let's say that you have a program that needs to store its files at /home/user/Downloads/.program. But you actually want to store those files on another partition, which is mounted at /x/partition. The way to do this via creating a symbolic link is that you can move the .program directory to /x/partition/.program, and then create a symbolic link at /home/user/Downloads/.program, and Linux will redirect it to /x/partition/.program.
Now that we understand what symbolic links actually do and how to use them, let's learn how we can create a symbolic link between directories on Linux.
To create a symbolic link, we make use of the ln command.
The ln command in Linux is used to create soft and hard links for files and folders in Linux.
Syntax
ln -s [OPTIONS] FILE LINK or ln dir1 dir2
Example 1
Syntax
ln -s /path/to/original /path/to/link
In the above command you can specify either a path to a directory or file in the command, it will work without any issue.
The -s in the command creates a symbolic link.
Command
ln -s /home/immukul/Downloads /home/immukul/Desktop
Output
lrwxrwxrwx 1 root root 18 May 20 11:32 /home/immukul/Desktop -> /home/immukul/Downloads
We can also remove the sym links with the help of the following command
rm /home/immukul/Downloads
Published on 29-Jul-2021 11:53:01
- Related Questions & Answers
- How to create a directory using Python?
- How to create a directory using Java?
- How to create a Directory using C#?
- How to create a bookmark link in HTML?
- How to create a download link with HTML?
- How to create a directory recursively using Python?
- How to create a Directory recursively using Java?
- How to create a directory hierarchy using Java?
- How to create a link to send email in HTML?
- How to create a link from a text using JavaScript?
- How to create a hyperlink to link another document in HTML?
- Create a directory in Java
- How to create a link to send email with a subject in HTML?
- How to create a unique directory name using Python?
- How to create a directory in project folder using Java?
how to create a symbolic link in linux
Source: https://www.tutorialspoint.com/how-to-create-a-symbolic-link-to-a-directory-in-ubuntu
Posted by: hubbardandome.blogspot.com
0 Response to "how to create a symbolic link in linux"
Post a Comment