How to create symbolic links in Ubuntu (shortcut to a directory)
⌚Aug 13, 2021
Sometimes directories can be long. Like really long. For example, working with Chia lately and their binaries are located in /usr/lib/chia-blockchain/resources/app.asar.unpacked/daemon/
to get the their chia
command.
A symbolic link in Linux (sometimes called a symlink) is a link that points to another directory on the system. This can help shorten the amount of typing and get the user to the destination. Creating a memorable link can also help remember where the link goes.
Symbolic links are really easy to make. They use a simple command: ln
.
An important part is to remember that you will need to use sudo
if your user requires it.
Let's take a look at the example I gave in the first paragraph; the directory: /usr/lib/chia-blockchain/resources/app.asar.unpacked/daemon/
For this, I'm going to make a symlink called chia that will allow me to go to that directory without typing every folder name and tabbing through.
Here's what you need to do for this example:
sudo ln -s /usr/lib/chia-blockchain/resources/app.asar.unpacked/daemon/ /chia
That's it! Now when you go to the terminal and use cd /chia
it will take you straight to the directory with all of the folders you don't feel like tabbing through.
I've been a Linux user for a few years and never really considered using this, but it has come in handy a few times when I really just need to save the typing space!
If you want to know more about how symlinks work, take a look at this symlink article on linuxhint.com or a more official symlink Ubuntu documentation.