What are your most frequently used shortcuts

Linux-ln command - how to create links on Linux

In order to be able to use the ln command in a meaningful and targeted manner under Linux, one should know the difference between soft and hard links: Soft links are cross-references that address an original file via a reference path. If you move or delete the original file, there is no longer any target object and the signpost becomes empty. On the other hand, if you delete the soft link, the original file is retained; only the reference to this file is removed. Soft links are also called symbolic links or (abbreviated) symlinks. Softlinks can not only be created with the ln command in the Linux terminal, but also with functions of the graphical user interface, for example in the Linux file manager. On the graphical user interface of Linux you can recognize a soft link on a Arrow symbol, which is also placed on the icon of the file.

Hard links can only be generated on the command line. They are more extensive than soft links integrated into the memory management of an operating system and the file system used. A hard link is an additional directory entry for an original file, whereby several hard links can refer to the same file. Ultimately, Linux does not differentiate technically and operationally between the original or original link (primary link) and a hard link generated later (follow-up and secondary link). Hence everyone is Directory entries equal and work independently of each other. A hard link can be used to access a file at different locations, which is often used for backups, for example.

The specifics and the How hard links work can best be explained with a concrete example. A video file that is initially only accessible in the "My Videos" directory can also be accessed via the "My Videos Backup" directory after creating a hard link. If you now delete the original file in "My Videos" (strictly speaking, only the primary reference to the video file is deleted), it can still be easily accessed via the equivalent parallel access (hardlink path to the file in the "My Videos Backup" directory). Hard links have the advantage that they have an additional note in the memory management not double the storage space takes. They are only alternative access options (via file path) and do not represent a complete second physical copy of a file.

Hard links are closely linked to a special internal bookkeeping system under Linux. Each hard link refers to a so-called inode and becomes an unmistakable and unique one Inode number assigned, which is also assigned to the original file. A file is only finally deleted in the inode administration and thus also in the system when all entries (i.e. all references to this file) have been deleted through delete operations have been declared invalid and an internal link counter has been set to zero. If only one address entry is deleted from several or the original file is moved to another directory, nothing changes. The remaining options stored in the inode for access to the original file are still valid.