JohnBeckett (talk | contribs) m (New When Hardlinked moved to Editing a hard link to a file: as decided at 200802) |
(Change <tt> to <code>, perhaps also minor tweak.) |
||
(One intermediate revision by the same user not shown) | |||
Line 1: | Line 1: | ||
+ | {{TipNew |
||
− | {{TipProposed |
||
− | |id= |
+ | |id=1590 |
− | |previous= |
+ | |previous=1589 |
− | |next= |
+ | |next=1591 |
− | |created= |
+ | |created=2008 |
|complexity=basic |
|complexity=basic |
||
|author=Metacosm |
|author=Metacosm |
||
Line 11: | Line 11: | ||
|category2= |
|category2= |
||
}} |
}} |
||
− | On Unix-based systems, the shell command < |
+ | On Unix-based systems, the shell command <code>ln x y</code> creates <code>y</code> as a hard link to file <code>x</code>. There is only a single file, so if you edit <code>y</code>, you will also change <code>x</code>. |
− | If wanted, you can configure Vim so that it will break hard links whenever a file is written, providing a backup is made. In that case, editing < |
+ | If wanted, you can configure Vim so that it will break hard links whenever a file is written, providing a backup is made. In that case, editing <code>y</code> would automatically remove the link, and create a separate file, leaving <code>x</code> unchanged. The Vim command (in [[vimrc]]) is: |
<pre> |
<pre> |
||
set backupcopy=auto,breakhardlink |
set backupcopy=auto,breakhardlink |
||
Line 19: | Line 19: | ||
==References== |
==References== |
||
− | *{{help|'backup'}} |
+ | *{{help|'backup'}} |
*{{help|'backupcopy'}} |
*{{help|'backupcopy'}} |
||
Latest revision as of 06:36, 13 July 2012
Tip 1590 Printable Monobook Previous Next
created 2008 · complexity basic · author Metacosm · version 7.0
On Unix-based systems, the shell command ln x y
creates y
as a hard link to file x
. There is only a single file, so if you edit y
, you will also change x
.
If wanted, you can configure Vim so that it will break hard links whenever a file is written, providing a backup is made. In that case, editing y
would automatically remove the link, and create a separate file, leaving x
unchanged. The Vim command (in vimrc) is:
set backupcopy=auto,breakhardlink