Is it possible to have a linked copy of a file that updates whenever the original is saved?

This is mainly for use with Google Drive and SVN, where I need a file to exist in two locations, but not be aliases.

  • Does it have to be a linked copy? I do roughly the same thing, but with OneDrive. I just save directly to the OneDrive directory. – Allan Jun 23 '17 at 16:22

Use a hard link with ln in Terminal. A hard link points to the file inode rather than the file location as with a symlink.

$ touch foo.txt
$ echo "this is foo" > foo.txt
$ ln foo.txt hardlink
$ cat hardlink
this is foo
$ mkdir bar
$ mv foo.txt bar
$ cat hardlink
this is foo

More on symbolic links vs hard links: https://askubuntu.com/q/108771/562767

  • Awesome, works perfectly. Good trick to know. Thanks. :D – Karric Jun 23 '17 at 22:19

You must log in to answer this question.

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