<s>
The	O
file	B-Application
command	I-Application
is	O
a	O
standard	O
program	B-Application
of	O
Unix	B-Application
and	O
Unix-like	B-Operating_System
operating	I-Operating_System
systems	I-Operating_System
for	O
recognizing	O
the	O
type	O
of	O
data	O
contained	O
in	O
a	O
computer	B-Operating_System
file	I-Operating_System
.	O
</s>
<s>
The	O
original	O
version	O
of	O
file	O
originated	O
in	O
Unix	B-Application
Research	O
Version	O
4	O
in	O
1973	O
.	O
</s>
<s>
System	B-Operating_System
V	I-Operating_System
brought	O
a	O
major	O
update	O
with	O
several	O
important	O
changes	O
,	O
most	O
notably	O
moving	O
the	O
file	O
type	O
information	O
into	O
an	O
external	O
text	O
file	O
rather	O
than	O
compiling	O
it	O
into	O
the	O
binary	O
itself	O
.	O
</s>
<s>
Most	O
major	O
BSD	B-Operating_System
and	O
Linux	B-Application
distributions	O
use	O
a	O
free	B-Application
,	O
open-source	B-Application
reimplementation	O
which	O
was	O
written	O
in	O
1986	O
–	O
87	O
by	O
Ian	O
Darwin	O
from	O
scratch	O
.	O
</s>
<s>
The	O
OpenBSD	B-Operating_System
system	O
has	O
its	O
own	O
subset	O
implementation	O
written	O
from	O
scratch	O
,	O
but	O
still	O
uses	O
the	O
Darwin/Zoulas	O
collection	O
of	O
magic	O
file	O
formatted	O
information	O
.	O
</s>
<s>
The	O
command	B-Application
has	O
also	O
been	O
ported	O
to	O
the	O
IBM	B-Application
i	I-Application
operating	B-General_Concept
system	I-General_Concept
.	O
</s>
<s>
The	O
Single	O
UNIX	B-Application
Specification	O
(	O
SUS	O
)	O
specifies	O
that	O
a	O
series	O
of	O
tests	O
are	O
performed	O
on	O
the	O
file	O
specified	O
on	O
the	O
command	B-Application
line	O
:	O
</s>
<s>
if	O
the	O
file	O
cannot	O
be	O
read	O
,	O
or	O
its	O
Unix	B-Application
file	I-Application
type	I-Application
is	O
undetermined	O
,	O
the	O
file	O
program	B-Application
will	O
indicate	O
that	O
the	O
file	O
was	O
processed	O
but	O
its	O
type	O
was	O
undetermined	O
.	O
</s>
<s>
This	O
differs	O
from	O
other	O
simpler	O
methods	O
such	O
as	O
file	O
extensions	O
and	O
schemes	O
like	O
MIME	B-Protocol
.	O
</s>
<s>
In	O
most	O
implementations	O
,	O
the	O
file	B-Application
command	I-Application
uses	O
a	O
database	O
to	O
drive	O
the	O
probing	O
of	O
the	O
lead	O
bytes	O
.	O
</s>
<s>
-h	O
,	O
do	O
not	O
dereference	O
symbolic	B-Application
links	I-Application
that	O
point	O
to	O
an	O
existing	O
file	O
or	O
directory	O
.	O
</s>
<s>
-L	O
,	O
dereference	O
the	O
symbolic	B-Application
link	I-Application
that	O
points	O
to	O
an	O
existing	O
file	O
or	O
directory	O
.	O
</s>
<s>
-i	O
,	O
do	O
not	O
classify	O
the	O
file	O
further	O
than	O
to	O
identify	O
it	O
as	O
either	O
:	O
nonexistent	O
,	O
a	O
block	O
special	B-Application
file	I-Application
,	O
a	O
character	O
special	B-Application
file	I-Application
,	O
a	O
directory	O
,	O
a	O
FIFO	B-Operating_System
,	O
a	O
socket	B-Protocol
,	O
a	O
symbolic	B-Application
link	I-Application
,	O
or	O
a	O
regular	O
file	O
.	O
</s>
<s>
Linux	B-Application
and	O
BSD	B-Operating_System
systems	O
behave	O
differently	O
with	O
this	O
option	O
and	O
instead	O
output	O
an	O
Internet	B-Application
media	I-Application
type	I-Application
(	O
"	O
MIME	B-Application
type	I-Application
"	O
)	O
identifying	O
the	O
recognized	O
file	O
format	O
.	O
</s>
<s>
Other	O
Unix	B-Application
and	O
Unix-like	B-Operating_System
operating	I-Operating_System
systems	I-Operating_System
may	O
add	O
extra	O
options	O
than	O
these	O
,	O
such	O
as	O
-s	O
'	O
special	B-Application
files	I-Application
 '	O
,	O
-k	O
'	O
keep-going	O
'	O
or	O
-r	O
'	O
raw	O
 '	O
(	O
examples	O
below	O
)	O
.	O
</s>
<s>
The	O
command	B-Application
tells	O
only	O
what	O
the	O
file	O
looks	O
like	O
,	O
not	O
what	O
it	O
is	O
(	O
in	O
the	O
case	O
where	O
file	O
looks	O
at	O
the	O
content	O
)	O
.	O
</s>
<s>
It	O
is	O
easy	O
to	O
fool	O
the	O
program	B-Application
by	O
putting	O
a	O
magic	O
number	O
into	O
a	O
file	O
the	O
content	O
of	O
which	O
does	O
not	O
match	O
it	O
.	O
</s>
<s>
Thus	O
the	O
command	B-Application
is	O
not	O
usable	O
as	O
a	O
security	O
tool	O
other	O
than	O
in	O
specific	O
situations	O
.	O
</s>
<s>
Note	O
that	O
-s	O
is	O
a	O
non-standard	O
option	O
available	O
only	O
on	O
some	O
platforms	O
,	O
which	O
tells	O
file	O
to	O
read	O
device	B-Application
files	I-Application
and	O
try	O
to	O
identify	O
their	O
contents	O
rather	O
than	O
merely	O
identifying	O
them	O
as	O
device	B-Application
files	I-Application
.	O
</s>
<s>
Normally	O
file	O
does	O
not	O
try	O
to	O
read	O
device	B-Application
files	I-Application
since	O
reading	O
such	O
a	O
file	O
can	O
have	O
undesirable	O
side	O
effects	O
.	O
</s>
<s>
Through	O
the	O
non-standard	O
option	O
-k	O
the	O
program	B-Application
does	O
not	O
stop	O
after	O
the	O
first	O
hit	O
found	O
,	O
but	O
looks	O
for	O
other	O
matching	O
patterns	O
.	O
</s>
<s>
Identifying	O
symbolic	B-Application
links	I-Application
is	O
not	O
available	O
on	O
all	O
platforms	O
and	O
will	O
be	O
dereferenced	O
if	O
-L	O
is	O
passed	O
or	O
POSIXLY_CORRECT	O
is	O
set	O
.	O
</s>
<s>
As	O
of	O
version	O
4.00	O
of	O
the	O
Ian	O
Darwin/Christos	O
Zoulas	O
version	O
of	O
file	O
,	O
the	O
functionality	O
of	O
file	O
is	O
incorporated	O
into	O
a	O
libmagic	B-Application
library	B-Library
that	O
is	O
accessible	O
via	O
C	B-Language
(	O
and	O
C-compatible	O
)	O
linking	O
;	O
file	O
is	O
implemented	O
using	O
that	O
library	B-Library
.	O
</s>
