Wikipedia defines a hard link as:

a directory entry that associates a name with a file on a file system. (A directory is itself a special kind of file that contains a list of such entries.) The term is used in file systems which allow multiple hard links to be created for the same file.

I am wondering if the concept of hard link is equivalent to the Windows concept of Shortcut.

If hard links are not equivalent to shortcuts, then what's the closest Windows feature to hard links?

  • 1
    There are actually some great references from that wiki page you shared. Mar 10, 2014 at 15:18
  • 8
    Microsoft NTFS does support hardlink and they are very similar to unix hardlink. I think shortcuts are special object ob the windows environnement but they are not related to the filesytem organization contrary to real hardlinks
    – Kiwy
    Mar 10, 2014 at 15:50
  • The following link gives a good explanations: comptb.cects.com/…
    – user256811
    Mar 10, 2014 at 18:04
  • 3
    I think the parallel is misleading, Shortcut are "interface" links just files with text information about the target that are interpreted by the interface and not by the filesystem. From a command line they are not really pointing to something in the filesystem sense. Windows (or better said NTFS) has proper symlinks en.wikipedia.org/wiki/NTFS_symbolic_link that are not shortcuts nor hardlinks. I fact I use them in Windows to have Dropbox folders anywhere, this cannot be done with shortcuts.
    – alfC
    Mar 10, 2014 at 23:34
  • 5
    The Windows shortcut files are very much like Linux .desktop files. Linux symlinks and hard links are a completely different thing that sometimes serve the same purpose. Mar 11, 2014 at 13:18

5 Answers 5


No, a hard link is completely different. A soft link is closer to a Windows shortcut (though there are important differences, symbolic links are more similar to windows shortcuts than hard links are). A hard link is a different thing and one you will almost never need.

Briefly, a soft link is created with this command:

ln -s foo bar

If you then run ls -l, you will see:

lrwxrwxrwx 1 terdon terdon 3 Mar 10 15:58 bar -> foo
-rw-r--r-- 2 terdon terdon 0 Mar 10 15:58 foo

The -> means that bar is a link to foo. So, opening bar, with a text editor for example, will actually open the separate file foo. However, deleting bar will just delete the shortcut, it will not affect the file foo.

Hard links, on the other hand, are created with this command:

ln foo bar

If you now run ls -l, there is no indication of any relationship between the files:

-rw-r--r-- 2 terdon terdon 0 Mar 10 15:58 bar
-rw-r--r-- 2 terdon terdon 0 Mar 10 15:58 foo

But—and this is very important—those are actually the same file. Files on Unix file systems are stored using inodes; an inode is basically the way the filesystem maps a file name to a particular location on the physical hard drive. So, hard links are files that point to the same inode as their target. Another way of putting this is that all files are actually hard links pointing to their inodes. Making a hard link to a file just creates a new pointer (file) on the file system that points to the same inode. Each inode can have multiple files pointing to it or one, or none.

To understand this more clearly, use ls -i which shows the inode associated with a file. Let's create a soft link and a hard link and see what happens:

ln -s foo SoftLinkToFoo
ln foo HardLinkToFoo

Now, check their inodes:

enter image description here

As you can see above, both foo and HardLinkToFoo have the same inode (16648029) while SoftLinkToFoo has a different one (16648036).

What happens if we rename foo with mv foo bar?

enter image description here

The red color indicates a broken soft link, one whose target can no longer be found. This is because soft links point to a file's name, not its inode. Note that despite changing the name, the inode remains the same so the hardlink is fine, it still works.

In summary, hard links are actually two manifestations of the same file; they are pointers to the same section of the disk. Soft links are just shortcuts. To take a real world analogy, hardlinks are like two different phone numbers for the same phone line and soft links are like having two different phone lines in the same house.

  • 6
    @Kiwy It's the opposite: absolute symlinks fail in many different ways (as soon as you move data around, mount it to a different place, back it up, …) and are best avoided. Mar 10, 2014 at 19:13
  • 4
    It's also worth noting that deleting (via rm or unlink()) a hard link only decrements the link count until the link count reaches zero, when the blocks occupied by the file contents are released. I'm not sure that saying “hard links are actually two instances of the same file” is strictly correct, since the two names point to the same inode, and thus the same content, rather than there being two instances of the file itself in any sense.
    – Emmet
    Mar 10, 2014 at 20:14
  • 7
    Note that a Windows shortcut is a file used by the shell and thus can do things that the shell knows about, but not the file system. E.g. you can make shortcuts into the shell namespace (e.g. Control Panel, Computer, etc.), or you can make shortcuts to applications yet to be installed (which will be installed at first use). Those things have no direct equivalent in the file system world.
    – Joey
    Mar 11, 2014 at 6:14
  • 2
    I love this answer but its actually quite poor at understanding what a Windows shortcut is. @Shaakunthala below has a better response as the Windows shortcut is more like a Linux .desktop file than a symlink. Mar 11, 2014 at 13:17
  • Does this answer says if I create a hard link and edit the original file, then the changes can be seen on the link? I tried that on macOS and it seems the files (original and link) are unrelated.
    – KcFnMi
    Sep 28, 2020 at 13:15

There's a good explanation of what soft and hard links are, but one thing needs to be clarified.

Windows shortcuts are equivalent or similar to neither soft links nor hard links. On the file system level they are just files. It's the shell that understands their structure and interprets them as links. Windows shortcuts can also point to objects in shell namespaces which aren't related to the file system (printers, control panel items, virtual folders).

Windows shortcuts, in addition to the name of the file system object, contain the following information: PIDL (opaque binary "path" within shell namespace), description, hotkey, icon, working directory. Windows also adds NTFS object identifiers if NTFS file system is used, to fix broken shortcuts.

The rough equivalent of a Windows shortcut is a .desktop file. See this question on SuperUser: Is there an equivalent of .lnk in Linux?


No. In Linux things work differently.

Each file is represented by an object called 'inode'. Every inode has a number (ID) associated with it.

As we know humans are not good at remembering numbers but names. (That's how phonebooks evolved)

Therefore, filename came into the picture to give each inode a human readable name. Basically, a hardlink binds a filename to an inode. An inode can have multiple hardlinks. If there are no hardlinks present for a particular inode, disk space used by the inode may be re-allocated for new files. Which means, at least one hardlink must present for each file. The filename (visualized as the filename/icon you see in file browser) itself is a hardlink.

In Windows, shortcut is a separate file (*.lnk file). It contains information about the original file (understandably the file path). In Linux perception, a Windows shortcut would be another inode hardlinked to a filename ending with '.lnk'.

  • 3
    NTFS actually works very much like this. A file is an entry in the MFT, and directory entries simply map filenames to file IDs. It supports hardlinks and, since 2008/7/Vista(?), even symlinks. At this point, the biggest difference is cultural.
    – cHao
    Mar 11, 2014 at 18:51

A big difference , hard-link cannot be created for folders , but for files .

Shortcut can be created for folders , so you cannot say they are equivalent .

Your question should be the difference between symbolic link or soft link and shortcut .

as according to this:

A symbolic link is filesystem level, and everything sees it as the original file. An application needs no special support to use a symbolic link.

A "Shortcut" is just a regular file that has a reference to the destination file or directory .

So when you click a shortcut will change your directory to the actual file , while soft-link will refer to its location as if its the actual file , for that in Linux you can use terminal and cd to symbolic links while you cannot cd to shortcuts .

A Windows shortcut and a Linux launcher (pointing to some location) would be identical.

  • 2
    What? Softlinks are just files, albeit strange ones, they also take up inodes for example. They are NOT treated as the original (that's hardlinks). While it's true that hardlinks are not allowed for directories in most OSs, this is just a safety feature and there are exceptions to this (OSX time machine for example). And of course you can cd to shortcuts (I assume you mean Windows shortcuts since as you say you can cd to soflinks).
    – terdon
    Mar 10, 2014 at 15:40
  • 1
    are you sure you can use cmd to cd to a shortcut .
    – nux
    Mar 10, 2014 at 15:43
  • 1
    I just fired up my Windows VM and created a shortcut to a folder on my Desktop, windows shortcuts are very similar (if not identical) to symlinks. While you cannot cd to them using cmd.exe for some reason, you can create a .lnk to a directory and use it via explorer.
    – terdon
    Mar 10, 2014 at 15:44
  • 1
    down voters should give a reason for downvoting
    – nux
    Mar 10, 2014 at 15:55
  • 6
    Sorry, still not correct. Symlinks are files containing their target as plain text (see here), symlinks are not treated as the original, that's the whole difference between symlinks and hardlinks. Linux launchers (I assume you mean .desktop files) have nothing to do with this at all, they are completely different. As you yourself say, Windows shortcuts can point to files (including programs) and folders (mac and windows have folders, Linux has directories) .desktop files just allow you to launch a program. They don't link anywhere.
    – terdon
    Mar 10, 2014 at 16:28

On Windows you can create hardlinks too if you have NTFS filesystem.

fsutil hardlink create target_file source_file

The files has to be on the same logical drive.

  • 1
    That's correct - NTFS supports hardlinks, too. Often the tools require you to have admin privilegues to create them. About the "same logical drive" - it would be more precise to say, they need to be on the same filesystem. A logical drive could be anything, including a drive letter created by the subst command. A tool might not know/care for this and thus refuse to create a hardlink, though. A very useful thing is the Link Shell Extension which enables the explorer to create them.
    – Tobias
    Mar 25, 2014 at 8:36

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .