Unix Basics | links | linking | soft link | hard link | symbolic link #unixtutorial #shorts

Soft links/Symbolic Links/Hard links

Links provide a mechanism to create a shortcut or different name for an existing file or directory, it may be helpful to have two different names that refer to the same file.

ln – make links between files
ln [options] [original filename] [link name]

Types of links :

Soft links/Symbolic Links

Hard Links

—————————————

Soft links/Symbolic Links :

A symbolic link is a special type of file that refers/points to another file or directory.

You can access original file data using any of the created Symbolic link.

Removing the symlink does not affect the original file.

But If you delete the original file, then all the Symbolic links on this file will be broken and we can’t access the data anymore.

ln -s file_name/directory new_link_name
ln -s test_soft_link.txt new_soft_link

Check the inode no# using ls –li
You need to on the same directory, where the link is present or give full path.
unlink new_soft_link

You can use rm command as well to remove the link, please note if you use rm command to delete the original file, then link will be broken.

find (directory ) -xtype l
find (directory ) -xtype l -delete

————————————–
#unixbasics #links #unix #unixtutorial #linking #unix #unixtutorial #softlink #hardlink #text #learning #coding #programming #symboliclink