Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

In Ubuntu (and Windows as well), I've noticed that whenever I create a file shortcut, and then move the file, the shortcut stops working, and becomes "broken". Is it possible to create a file shortcut in such a way that the shortcut will automatically point to the file's current location, instead of breaking whenever the file is moved?

share|improve this question

migrated from Aug 24 '12 at 4:09

This question came from our site for Ubuntu users and developers.

This is a cross-platform issue, and not just an Ubuntu-specific issue, but I decided to post it here because I'm currently trying to solve this problem on Ubuntu. – Anderson Green Aug 24 '12 at 2:19
It looks like this program might do something like this, but it only works on Windows:… – Anderson Green Aug 24 '12 at 2:22
up vote 4 down vote accepted

Use the ln (link) command without the -s (symbolic) switch. The link will persist when moving the file within the file system.

ln foo baz
mv foo bar

baz will still link to the file originally known as foo.

share|improve this answer
There are some restrictions though: hard-links only work within the same filesystem and it's not possible to make hard-links to directories. – Sergey Aug 24 '12 at 2:34
@ubfan1 Can you explain what xx, lxx, and yy are supposed to represent here? Should they each be substituted with file names, or left as-is? – Anderson Green Aug 24 '12 at 3:43
@AndersonGreen: I took the liberty of changing the placeholder to "foo bar baz" for intended clarity. – Daniel Andersson Aug 24 '12 at 8:29
@DanielAndersson Is it possible to do this on Windows, as well as Unix-like operating systems? – Anderson Green Aug 24 '12 at 18:38
@AndersonGreen: Well, all POSIX systems as well as NTFS has support for hard links. I have never used it in a Windows context personally, so I don't know how it works in practice, though. There is a command line tool mklink that creates hard links. If you want a GUI, you probably need third party software. – Daniel Andersson Aug 24 '12 at 20:02

You must log in to answer this question.

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