- Trending Categories
Data Structure
Networking
RDBMS
Operating System
Java
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
Physics
Chemistry
Biology
Mathematics
English
Economics
Psychology
Social Studies
Fashion Studies
Legal Studies
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
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
- Related Articles
- How to create a bookmark link in HTML?
- How to create a Directory using C#?
- How to create a directory using Java?
- How to create a directory using Python?
- How to create a link to send email in HTML?
- How to create a download link with HTML?
- How to create a directory hierarchy using Java?
- How to create a Directory recursively using Java?
- How to create a directory recursively using Python?
- How to create a hyperlink to link another document in HTML?
- How to create a link from a text using JavaScript?
- How to create a link to send email with a subject in HTML?
- How to create a directory in project folder using Java?
- How to create a unique directory name using Python?
- How to create a zip archive of a directory using Python?
