Linux Operating Systems: How to create shortcuts!

Linux Operating System

Linux is an operating system that offers flexibility. It's open-source software equipped with the necessary features needed for your specific needs.  Right from its kernel, the flexibility goes all the way to the desktop environment has many similarities with UNIX.The ability to understand how to use links in Linux is very important. If you want to have more than one version of a similar file on your system, this skill will come readily at hand.  Most users would have several copies of the file on the Linux system. The option brings other issues at play and not just having one single physical copy with multiple numerous copies in virtual commonly known as Links.

Links in Linux

Links are placeholders domiciled in a directory that directs to the actual location of your file or files. They come in handy when creating shortcuts to the original directory of files.  In many cases, Links are used to create convenient paths to a file or directory stored in a large or big file hierarchy. They can be used to link libraries, files in one location without moving files. They are used to also keep a copy of a file in several accessible locations in the system.We have two types of Linux filesystem links namely:
  1. Soft or symbolic link
  2. Hard link
The difference between a hard link and a soft link is significant, to say the least, but both provide multiple directory references into a single file albeit using different approaches. Links are such powerful tools that bring flare, and flexibility to users of Linux when it comes to filesystems.

Symbolic link

Known as a soft link is a physical file that directs to another file in the virtual directory structure in the Linux OS. Usually, the two files that point to each other are neither the same nor contain the same information.The original file should exist for you to create a soft link/ symbolic link. Use the In command combined with the –s option to successfully create a soft link /symbolic link.In the following example, the name of sl_logs.txt as a symbolic link is placed second in the ln command.You can eventually use ls -l to check if the two files are linked together. The display of -> after a soft link/symbolic link filename indicates that the file is linked symbolically to the file backup.tar.You can compare the file size of the soft link/symbolic link with that of one of the logs.txt files. The soft link /symbolic link sl_logs.txt file is 8bytes as compared to the file logs.txt which is 46bytes long. The reason for this is because sl_logs.txt files point to logs.txt although they are two distinct files from each other, and do not share the file contents


Viewing their inode numbers is a different way to check and confirm that the linked files are physically different from one another. An inode number is a unique identifier assigned to a number of a file or directory in the kernel to each one of the objects in the file system.To see the inode number for a specific file or directory you can use the -i option and the ls command.The below example displays an inode number of the logs.txt file as 2097212 while the inode number of the sl_logs.txt file is shown as 2097193. This means that these though linked together are different and contain unrelated contents.
Symbolic link image
Image courtesy: Symbolic link
A good way of using symbolic links is by linking third-party binaries . They can easily be downloaded from the internet into the /bin directory. They enable you to execute the commands anywhere from the command line instead of navigating to where binaries are located.

Hard link

Unlike the soft link, a hard link creates a separate virtual file keeping intact the information about the original file and where it is stored. Always, the two files linked are the same physical file with the same content.When creating a hard link, there must exist the original file and no options are required on the command In as is with other case scenarios.
Hard link image
Image courtesy: Hard link image
In creating a hard link, the Is-li command is used to display the inode numbers. The listing for logs.txt and hl_logs.txt files in the system.It is important to know that hard-linked files bear the same inode number. This is because they are physically same file with identical sizes.

Differences between soft link & hard link

Soft link
Just like we understand shortcuts in windows, Soft links do point to any directory or file in the filling system. A soft link/Symbolic link is a pointer to the file name. It doesn't accesses the information contained in the original file. If the original file is deleted the soft link will point to a file that doesn’t exist
Hard Link
Hard links are very similar to shortcuts for folders and or folders. But the differential factor is that they cannot be created for directories/files in file systems that are different. A hard link is a mirror or copy of the highlighted file. It can access the available data in the original file.  If the original file is deleted, the hard link to the file will still have the data or information of that file.
"The advance of technology is based on making it fit in so that you don't even notice it, so it's part of everyday life." - Bill Gates, Co-founder of Microsoft.
Also read Computer Operating Systems (OS)Please add your comments or positive criticism and suggestion using the comment section below.
PreviousWhat is computer operating system?
NextTransmission Media: How signals are processed

Leave a Reply

Scroll to Top
Share via
Copy link