<s>
In	O
computing	O
,	O
a	O
hard	B-Application
link	I-Application
is	O
a	O
directory	B-Application
entry	O
(	O
in	O
a	O
directory-based	O
file	B-Application
system	I-Application
)	O
that	O
associates	O
a	O
name	O
with	O
a	O
file	B-Operating_System
.	O
</s>
<s>
Thus	O
,	O
each	O
file	B-Operating_System
must	O
have	O
at	O
least	O
one	O
hard	B-Application
link	I-Application
.	O
</s>
<s>
Creating	O
additional	O
hard	B-Application
links	I-Application
for	O
a	O
file	B-Operating_System
makes	O
the	O
contents	O
of	O
that	O
file	B-Operating_System
accessible	O
via	O
additional	O
paths	B-Application
(	O
i.e.	O
,	O
via	O
different	O
names	O
or	O
in	O
different	O
directories	B-Application
)	O
.	O
</s>
<s>
This	O
causes	O
an	O
alias	B-Application
effect	I-Application
:	O
a	O
process	O
can	O
open	O
the	O
file	B-Operating_System
by	O
any	O
one	O
of	O
its	O
paths	B-Application
and	O
change	O
its	O
content	O
.	O
</s>
<s>
By	O
contrast	O
,	O
a	O
soft	B-Application
link	I-Application
or	O
“	O
shortcut	O
”	O
to	O
a	O
file	B-Operating_System
is	O
not	O
a	O
direct	O
link	B-Device
to	O
the	O
data	O
itself	O
,	O
but	O
rather	O
a	O
reference	O
to	O
a	O
hard	B-Application
link	I-Application
or	O
another	O
soft	B-Application
link	I-Application
.	O
</s>
<s>
Every	O
directory	B-Application
is	O
itself	O
a	O
special	O
file	B-Operating_System
,	O
only	O
it	O
contains	O
a	O
list	O
of	O
file	B-Operating_System
names	O
.	O
</s>
<s>
Hence	O
,	O
multiple	O
hard	B-Application
links	I-Application
to	O
directories	B-Application
are	O
possible	O
,	O
which	O
could	O
create	O
a	O
circular	O
directory	B-Application
structure	O
,	O
rather	O
than	O
a	O
branching	O
structure	O
like	O
a	O
tree	B-Data_Structure
.	O
</s>
<s>
For	O
that	O
reason	O
,	O
some	O
file	B-Application
systems	I-Application
forbid	O
the	O
creation	O
of	O
hard	B-Application
links	I-Application
to	O
directories	B-Application
.	O
</s>
<s>
POSIX-compliant	O
operating	B-General_Concept
systems	I-General_Concept
,	O
such	O
as	O
Linux	B-Application
,	O
Android	B-Application
,	O
macOS	B-Application
,	O
and	O
the	O
Windows	B-Device
NT	I-Device
family	I-Device
,	O
support	O
multiple	O
hard	B-Application
links	I-Application
to	O
the	O
same	O
file	B-Operating_System
,	O
depending	O
on	O
the	O
file	B-Application
system	I-Application
.	O
</s>
<s>
For	O
instance	O
,	O
NTFS	B-Application
and	O
ReFS	B-Application
support	O
hard	B-Application
links	I-Application
,	O
while	O
FAT	B-Application
does	O
not	O
.	O
</s>
<s>
Let	O
two	O
hard	B-Application
links	I-Application
,	O
named	O
"	O
LINK	B-Device
A.TXT	O
"	O
and	O
"	O
LINK	B-Device
B.TXT	O
"	O
,	O
point	O
to	O
the	O
same	O
physical	O
data	O
.	O
</s>
<s>
A	O
text	B-Application
editor	I-Application
opens	O
"	O
LINK	B-Device
A.TXT	O
"	O
,	O
modifies	O
it	O
and	O
saves	O
it	O
.	O
</s>
<s>
When	O
the	O
editor	O
(	O
or	O
any	O
other	O
app	O
)	O
opens	O
"	O
LINK	B-Device
B.TXT	O
"	O
,	O
it	O
can	O
see	O
those	O
changes	O
made	O
to	O
"	O
LINK	B-Device
A.TXT	O
"	O
,	O
since	O
both	O
file	B-Operating_System
names	O
point	O
to	O
the	O
same	O
data	O
.	O
</s>
<s>
So	O
from	O
a	O
user	O
's	O
point	O
of	O
view	O
this	O
is	O
one	O
file	B-Operating_System
with	O
several	O
filenames	O
.	O
</s>
<s>
Editing	O
any	O
filename	O
modifies	O
"	O
all	O
"	O
files	O
,	O
however	O
deleting	O
"	O
any	O
"	O
filename	O
except	O
the	O
last	O
one	O
keeps	O
the	O
file	B-Operating_System
around	O
.	O
</s>
<s>
However	O
,	O
some	O
editors	O
,	O
such	O
as	O
GNU	B-Application
Emacs	I-Application
,	O
break	O
the	O
hard	B-Application
link	I-Application
concept	O
.	O
</s>
<s>
When	O
opening	O
a	O
file	B-Operating_System
for	O
editing	O
,	O
e.g.	O
,	O
"	O
LINK	B-Device
B.TXT	O
"	O
,	O
emacs	O
renames	O
"	O
LINK	B-Device
B.TXT	O
"	O
to	O
"	O
LINK	B-Device
B.TXT	O
~	O
"	O
,	O
loads	O
"	O
LINK	B-Device
B.TXT	O
~	O
"	O
into	O
the	O
editor	O
,	O
and	O
saves	O
the	O
modified	O
contents	O
to	O
a	O
newly	O
created	O
"	O
LINK	B-Device
B.TXT	O
"	O
.	O
</s>
<s>
Now	O
,	O
"	O
LINK	B-Device
A.TXT	O
"	O
and	O
"	O
LINK	B-Device
B.TXT	O
"	O
no	O
longer	O
shares	O
the	O
same	O
data	O
.	O
</s>
<s>
Any	O
number	O
of	O
hard	B-Application
links	I-Application
to	O
the	O
physical	O
data	O
may	O
be	O
created	O
.	O
</s>
<s>
To	O
access	O
the	O
data	O
,	O
a	O
user	O
only	O
needs	O
to	O
specify	O
the	O
name	O
of	O
any	O
existing	O
link	B-Device
;	O
the	O
operating	B-General_Concept
system	I-General_Concept
will	O
resolve	O
the	O
location	O
of	O
the	O
actual	O
data	O
.	O
</s>
<s>
Even	O
if	O
the	O
user	O
deletes	O
one	O
of	O
the	O
hard	B-Application
links	I-Application
,	O
the	O
data	O
is	O
still	O
accessible	O
through	O
any	O
other	O
link	B-Device
that	O
remains	O
.	O
</s>
<s>
Once	O
the	O
user	O
deletes	O
all	O
of	O
the	O
links	O
,	O
if	O
no	O
process	O
has	O
the	O
file	B-Operating_System
open	O
,	O
the	O
operating	B-General_Concept
system	I-General_Concept
frees	O
the	O
disk	O
space	O
that	O
the	O
file	B-Operating_System
once	O
occupied	O
.	O
</s>
<s>
Most	O
file	B-Application
systems	I-Application
that	O
support	O
hard	B-Application
links	I-Application
use	O
reference	B-General_Concept
counting	I-General_Concept
.	O
</s>
<s>
The	O
system	O
stores	O
an	O
integer	O
value	O
with	O
each	O
logical	O
data	O
section	O
that	O
represents	O
the	O
total	O
number	O
of	O
hard	B-Application
links	I-Application
that	O
have	O
been	O
created	O
to	O
point	O
to	O
the	O
data	O
.	O
</s>
<s>
When	O
a	O
new	O
link	B-Device
is	O
created	O
,	O
this	O
value	O
is	O
increased	O
by	O
one	O
.	O
</s>
<s>
When	O
a	O
link	B-Device
is	O
removed	O
,	O
the	O
value	O
is	O
decreased	O
by	O
one	O
.	O
</s>
<s>
When	O
the	O
counter	O
becomes	O
zero	O
,	O
the	O
operating	B-General_Concept
system	I-General_Concept
frees	O
the	O
logical	O
data	O
section	O
.	O
</s>
<s>
(	O
The	O
OS	O
may	O
not	O
to	O
do	O
so	O
immediately	O
,	O
e.g.	O
,	O
when	O
there	O
are	O
outstanding	O
file	B-Operating_System
handles	O
open	O
,	O
for	O
performance	O
reasons	O
,	O
or	O
to	O
enable	O
the	O
undelete	O
command	O
.	O
)	O
</s>
<s>
This	O
is	O
a	O
simple	O
method	O
for	O
the	O
file	B-Application
system	I-Application
to	O
track	O
the	O
use	O
of	O
a	O
given	O
area	O
of	O
storage	O
,	O
as	O
zero	O
values	O
indicate	O
free	O
space	O
and	O
nonzero	O
values	O
indicate	O
used	O
space	O
.	O
</s>
<s>
The	O
maintenance	O
of	O
this	O
value	O
guarantees	O
that	O
there	O
will	O
be	O
no	O
dangling	O
hard	B-Application
links	I-Application
pointing	O
nowhere	O
.	O
</s>
<s>
The	O
data	O
section	O
and	O
the	O
associated	O
inode	B-Application
are	O
preserved	O
as	O
long	O
as	O
a	O
single	O
hard	B-Application
link	I-Application
(	O
directory	B-Application
reference	O
)	O
points	O
to	O
it	O
or	O
any	O
process	O
keeps	O
the	O
associated	O
file	B-Operating_System
open	O
.	O
</s>
<s>
On	O
POSIX-compliant	O
operating	B-General_Concept
systems	I-General_Concept
,	O
the	O
reference	B-General_Concept
count	I-General_Concept
for	O
a	O
file	B-Operating_System
or	O
directory	B-Application
is	O
returned	O
by	O
the	O
stat( )	O
or	O
fstat( )	O
system	B-Operating_System
calls	I-Operating_System
in	O
the	O
st_nlink	O
field	O
of	O
struct	O
stat	B-Language
.	O
</s>
<s>
To	O
prevent	O
loops	O
in	O
the	O
filesystem	B-Application
,	O
and	O
to	O
keep	O
the	O
interpretation	O
of	O
the	O
""	O
file	B-Operating_System
(	O
parent	B-Application
directory	I-Application
)	O
consistent	O
,	O
operating	B-General_Concept
systems	I-General_Concept
do	O
not	O
allow	O
hard	B-Application
links	I-Application
to	O
directories	B-Application
.	O
</s>
<s>
UNIX	B-Operating_System
System	I-Operating_System
V	I-Operating_System
allowed	O
them	O
,	O
but	O
only	O
the	O
superuser	B-Application
had	O
permission	O
to	O
make	O
such	O
links	O
.	O
</s>
<s>
Mac	B-Application
OS	I-Application
X	I-Application
v10.5	I-Application
(	O
Leopard	B-Application
)	O
and	O
newer	O
use	O
hard	B-Application
links	I-Application
on	O
directories	B-Application
for	O
the	O
Time	B-Operating_System
Machine	I-Operating_System
backup	O
mechanism	O
only	O
.	O
</s>
<s>
Hard	B-Application
links	I-Application
can	O
be	O
created	O
to	O
files	O
only	O
on	O
the	O
same	O
volume	O
,	O
i.e.	O
,	O
within	O
the	O
same	O
file	B-Application
system	I-Application
.	O
</s>
<s>
(	O
Different	O
volumes	O
may	O
have	O
different	O
file	B-Application
systems	I-Application
.	O
</s>
<s>
There	O
is	O
no	O
guarantee	O
that	O
the	O
target	O
volume	O
's	O
file	B-Application
system	I-Application
is	O
compatible	O
with	O
hard	B-Application
linking	I-Application
.	O
)	O
</s>
<s>
The	O
maximum	O
number	O
of	O
hard	B-Application
links	I-Application
to	O
a	O
single	O
file	B-Operating_System
is	O
limited	O
by	O
the	O
size	O
of	O
the	O
reference	O
counter	O
.	O
</s>
<s>
On	O
Unix-like	B-Operating_System
systems	I-Operating_System
the	O
counter	O
is	O
4,294,967,295	O
(	O
on	O
32-bit	O
machines	O
)	O
or	O
18,446,744,073,709,551,615	O
(	O
on	O
64-bit	O
machines	O
)	O
.	O
</s>
<s>
In	O
some	O
file	B-Application
systems	I-Application
,	O
the	O
number	O
of	O
hard	B-Application
links	I-Application
is	O
limited	O
more	O
strictly	O
by	O
their	O
on-disk	O
format	O
.	O
</s>
<s>
For	O
example	O
,	O
as	O
of	O
Linux	B-Application
3.11	O
,	O
the	O
ext4	B-Application
file	B-Application
system	I-Application
limits	O
the	O
number	O
of	O
hard	B-Application
links	I-Application
on	O
a	O
file	B-Operating_System
to	O
65,000	O
.	O
</s>
<s>
Windows	O
limits	O
enforces	O
a	O
limit	O
of	O
1024	O
hard	B-Application
links	I-Application
to	O
a	O
file	B-Operating_System
on	O
NTFS	B-Application
volumes	O
.	O
</s>
<s>
On	O
Linux	B-Application
Weekly	O
News	O
,	O
Neil	O
Brown	O
criticized	O
hard	B-Application
links	I-Application
as	O
high-maintenance	O
,	O
since	O
they	O
complicate	O
the	O
design	O
of	O
programs	O
that	O
handle	O
directory	B-Application
trees	I-Application
,	O
including	O
archivers	O
and	O
disk	O
usage	O
tools	O
.	O
</s>
<s>
Brown	O
notes	O
that	O
Plan	B-Operating_System
9	I-Operating_System
from	I-Operating_System
Bell	I-Operating_System
Labs	I-Operating_System
,	O
the	O
intended	O
successor	O
to	O
Unix	O
,	O
does	O
not	O
include	O
the	O
concept	O
of	O
a	O
hard	B-Application
link	I-Application
.	O
</s>
<s>
Windows	B-Device
NT	I-Device
3.1	I-Device
and	O
later	O
support	O
hard	B-Application
links	I-Application
on	O
the	O
NTFS	B-Application
file	I-Application
system	I-Application
.	O
</s>
<s>
Windows	B-Application
2000	I-Application
introduces	O
a	O
CreateHardLink( )	O
function	O
to	O
create	O
hard	B-Application
links	I-Application
,	O
but	O
only	O
for	O
files	O
,	O
not	O
directories	B-Application
.	O
</s>
<s>
To	O
create	O
a	O
hard	B-Application
link	I-Application
on	O
Windows	O
,	O
end-users	O
can	O
use	O
:	O
</s>
<s>
To	O
interrogate	O
a	O
file	B-Operating_System
for	O
its	O
hard	B-Application
links	I-Application
,	O
end-users	O
can	O
use	O
:	O
</s>
<s>
The	O
Get-Item	O
and	O
Get-ChildItem	O
cmdlets	O
of	O
PowerShell	B-Application
.	O
</s>
<s>
These	O
cmdlets	O
represent	O
each	O
file	B-Operating_System
with	O
an	O
object	O
;	O
PowerShell	B-Application
adds	O
a	O
read-only	O
LinkType	O
property	O
to	O
each	O
of	O
them	O
.	O
</s>
<s>
This	O
property	O
contains	O
the	O
string	O
if	O
the	O
associated	O
file	B-Operating_System
has	O
multiple	O
hard	B-Application
links	I-Application
.	O
</s>
<s>
The	O
Windows	O
Component	O
Store	O
uses	O
hard	B-Application
links	I-Application
to	O
keep	O
track	O
of	O
different	O
versions	O
of	O
components	O
stored	O
on	O
the	O
hard	O
disk	O
drive	O
.	O
</s>
<s>
On	O
Unix-like	B-Operating_System
systems	I-Operating_System
,	O
the	O
system	B-Operating_System
call	I-Operating_System
can	O
create	O
additional	O
hard	B-Application
links	I-Application
to	O
existing	O
files	O
.	O
</s>
<s>
To	O
create	O
hard	B-Application
links	I-Application
,	O
end-users	O
can	O
use	O
:	O
</s>
<s>
To	O
interrogate	O
a	O
file	B-Operating_System
for	O
its	O
hard	B-Application
links	I-Application
,	O
end-users	O
can	O
use	O
:	O
</s>
<s>
Unix-like	B-Operating_System
emulation	O
or	O
compatibility	O
software	O
running	O
on	O
Microsoft	O
Windows	O
,	O
such	O
as	O
Cygwin	B-Language
and	O
Subsystem	B-Operating_System
for	I-Operating_System
UNIX-based	I-Operating_System
Applications	I-Operating_System
,	O
allow	O
the	O
use	O
of	O
POSIX	O
interfaces	O
.	O
</s>
<s>
OpenVMS	B-Operating_System
supports	O
hard	B-Application
links	I-Application
on	O
the	O
ODS-5	B-Application
file	B-Application
system	I-Application
.	O
</s>
<s>
Unlike	O
Unix	O
,	O
VMS	B-Operating_System
can	O
create	O
hard	B-Application
links	I-Application
to	O
directories	B-Application
.	O
</s>
