

You can confirm the inode and check other metadata information with the stat command.Ĭreate a file inside this directory and check the same information: $ touch dir/file You can see that the inode address of the given dir directory below is 25606589. Use the ls command with the -i option to display inodes. You can see inodes in action by creating a directory and then looking at its inode and size information: $ mkdir dirĢ5606589 drwxrwxr-x. It stores metadata pertaining to that object, including time stamps, block maps, or extended attributes. A hard link can only point to a file, not a directory, and it doesn't add to the overall index node (inode) count.Īn inode is a data structure describing a filesystem object, such as a file or a directory.
#UNIX LINK LN HOW TO#
Note that it removes only the soft link that you created, it does not remove the original directory/file that you soft linked.In my previous article, I demonstrated how to create a hard link that looks like a unique file but actually points back to another file. The second way is to use the unlink command followed by the softlink name. There are two linux commands you can use to remove soft link In case you decide to remove the soft or symbolic link, it is pretty easy to do. How to Remove soft link or Symbolic link? On the other hand the soft link lets you treat like any other directory and perform any operations you like. You need to create other aliases to perform more operations. The way to do that is use it like as given below.Īlias easyPath = “cd /my/long/path/to/the/directory simplePath”Īs you can see the above “alias” option only creates an alias for “cd ” to the directory.

bashrc/.profile or other the shell file that you use. (Yes, one needs to resent the soft link every time the primary data directory changes) Setting up aliasĪnother possible solution is to use “ alias” and put that alias in your. So for all your work, you will be accessing data from soft link that is the same while the underlying primary data directory may change often. It can save you loads of key strokes and valuable time.Īnother common use of creating a softlink with “ln -s” is often you may have your primary data in a directory that can change, but have softlinked directory, that is fixed, pointing to the primary data directory. And use the simple path directory every time to reach to the long-path directory. If you have color coded the files and directories, the softlink paths will be in a different color than regular directories.

And the simple path will be linked to the long path, you can see that by using “ls -l”, likeĮasyPath -> /my/long/path/to/the/directory Once you create a soft link, you will see the new simple path directory in the current directory. This will create a soft link (or symbolic link) for the directory. Ln -s /my/long/path/to/the/directory easyPath You can easily create a soft link with a simple short name for the long-path directory and use the simple name to get to your long-path directory.įor example, use “ ln -s” by typing the following command at your terminal. The argument “s” makes the the link symbolic or soft link instead of hard link. The ln command in Linux creates links between files/directory. Well, the command “ln -s” offers you a solution by letting you create a soft link. How To Create Soft Link?If you are using a really long path to reach a directory (my/really/long/path/to/the/directory) frequently, it will get painful to type the long path every time to get there.
