Command Line

Let’s Make A Symbolic Link

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!

Ah well…

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 CTRL + ALT + T and your default terminal should open.

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>

Obviously, the -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:

cat ~/ln_test

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!

Closure:

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.

KGIII

Retired mathematician, residing in the mountains of Maine. I may be old and wise, but I am not infallible. Please point out any errors. And, as always, thanks again for reading.

Recent Posts

Enable/Disable Your Network Interface

Today we'll cover one way to enable or disable your network interface in the Linux…

7 months ago

Check Your NIC Speed In The Terminal

Today's exercise is a nice and simple exercise where we check your NIC speed in…

7 months ago

Easily Monitor Your Wireless Connection

Have you ever wanted to easily monitor your wireless connection? Well, now you can learn…

7 months ago

Count The Files In A Directory

I think I've covered this before with the ls command but this time we'll count…

7 months ago

Get System Information With The ‘uname’ Command In Linux

Today we'll be learning about a basic Linux command that's known as 'uname' and it…

7 months ago

hardinfo Has Been Rebooted As hardinfo2

If you've used hardinfo in the past, it may interest you to know that hardinfo…

7 months ago