--- layout: page category: Filesystem tags: Hard links author: Ricardo Vivanco title: fs previous-page: pages/fs/Hard:symbolic_links.html ---

How to Create Hard Links in Linux

To create a hard links in Linux, we will use ln utility. For example, if you want to create a hard link named "hard_link1" to the file "file1" you can use first the ls -l command in order to see all files. Then you write ln "file1" "hard_link1" and after that if you write down again ls -l you can finally see the hard link named "hard_link1" created. Looking at that output, using ls command, the new file is not indicated as a link, it is shown as a regular file. This implies that "hard_link1" is just another regular executable file that points to the same underlying inode as "file1". If you desire to make a hard link directly into a soft link, use the -P flag like this: ln -P "file1" "hard_link1"