In this article, we’re going to learn how to make a symbolic link. This will be a very easy article, and one you may get some use from. It’s not terribly hard to make a symbolic link, though I suppose the syntax may seem quirky as compared to many other commands. It’s not hard, trust me on this… Or not… You can pretend it’s hard and impress your friends and family!
So, what’s a symbolic link? Well, it’s a link to another file. A symbolic link is a file that contains nothing more than a link to another file. There’s a hard link as well, and that points to an inode. A symbolic link is a bit more versatile. You can make a symbolic link (again, a file) and move it around the system and it’ll still point at the original file. It’s useful if you want to do things like put shortcuts on your desktop.
This being Linux, everything is a file. A symbolic link is a file. It is a file that contains information about where another file is located. Some folks think this sort of stuff is complicated, perhaps too complicated for a new Linux user, but I think it’s easy – so long as it’s properly explained. Darned if I know how to explain it! I hope that worked for you. That’s really all it is. That’s it. It’s just a file that contains information about where another file is located. Everything is a file.
Like I said, this is going to be a short article. It really shouldn’t be all that difficult to show you how to …
Make A Symbolic Link:
This article requires an open terminal, like many other articles on this site. If you don’t know how to open the terminal, you can do so with your keyboard – just press
Now, pick a file… One that most users will have will be your Bash history, located at
~/.bash_history unless you’ve really done some heavy modifications. Let’s use that file to make a symbolic link.
The format to do this is:
ln -s <existing_file> <new_file>
-s means ‘symbolic’ (feel free to check ‘
man ln‘ for more information) and you name the existing file first and then the file you want to create. So, to do this with
.bash_history, it’d look like:
ln -s ~/.bash_history ln_test
Now, you can see it in action:
Tada! It will show the contents of your
.bash_history if you did everything correct. Want to see something even more handy?
mv ~/test ~/Desktop
Now, look at your desktop and open the file named ‘test’ – or just navigate there in your terminal and check it again with the cat command:
cd ~/Desktop && cat test
Congratulations! You’ve learned how to make a symbolic link! I told you that it wasn’t all that hard. As a concept, it’s even easier to understand. The syntax to do so isn’t even all that difficult. You’ve got this! I have faith!
Yes, yes I did say this would be quick and easy. I think it was. It’s not terribly hard to make a symbolic link and it was a fun article to write. It’s fun to cover some of the basics. As the tagline says, “Getting you up to speed!” Search around or just browse, you might be amazed at the subjects covered!
Thanks for reading! If you want to help, or if the site has helped you, you can donate, register to help, write an article, or buy inexpensive hosting to start your own site. If you scroll down, you can sign up for the newsletter, vote for the article, and comment.