<s>
cat	O
is	O
a	O
standard	O
Unix	B-Application
utility	I-Application
that	O
reads	O
files	O
sequentially	O
,	O
writing	O
them	O
to	O
standard	O
output	O
.	O
</s>
<s>
cat	O
was	O
part	O
of	O
the	O
early	O
versions	O
of	O
Unix	B-Application
,	O
e.g.	O
,	O
Version	B-Operating_System
1	I-Operating_System
,	O
and	O
replaced	O
pr	O
,	O
a	O
PDP-7	B-Device
and	O
Multics	B-Application
utility	O
for	O
copying	O
a	O
single	O
file	O
to	O
the	O
screen	O
.	O
</s>
<s>
The	O
version	O
of	O
cat	O
bundled	O
in	O
GNU	B-Application
coreutils	I-Application
was	O
written	O
by	O
Torbjorn	O
Granlund	O
and	O
Richard	O
Stallman	O
.	O
</s>
<s>
The	O
ReactOS	B-Application
version	O
was	O
written	O
by	O
David	O
Welch	O
,	O
Semyon	O
Novikov	O
,	O
and	O
Hermès	O
Bélusca	O
.	O
</s>
<s>
Over	O
time	O
,	O
alternative	O
utilities	O
such	O
as	O
tac	B-Device
and	O
bat	O
also	O
became	O
available	O
,	O
bringing	O
different	O
new	O
features	O
.	O
</s>
<s>
With	O
a	O
single	O
argument	O
,	O
it	O
is	O
often	O
used	O
to	O
print	O
a	O
file	O
to	O
the	O
user	O
's	O
terminal	B-Application
emulator	I-Application
(	O
or	O
historically	O
to	O
a	O
computer	B-General_Concept
terminal	I-General_Concept
or	O
teletype	O
)	O
.	O
</s>
<s>
The	O
combined	O
result	O
is	O
by	O
default	O
also	O
printed	O
to	O
the	O
terminal	O
,	O
but	O
often	O
users	O
redirect	B-Device
the	O
result	O
into	O
yet	O
another	O
file	O
.	O
</s>
<s>
The	O
Single	O
Unix	B-Application
Specification	O
defines	O
the	O
operation	O
of	O
cat	O
to	O
read	O
files	O
in	O
the	O
sequence	O
given	O
in	O
its	O
arguments	O
,	O
writing	O
their	O
contents	O
to	O
the	O
standard	O
output	O
in	O
the	O
same	O
sequence	O
.	O
</s>
<s>
Some	O
operating	O
systems	O
,	O
like	O
the	O
ones	O
using	O
GNU	B-Application
Core	I-Application
Utilities	I-Application
,	O
do	O
this	O
by	O
default	O
and	O
ignore	O
the	O
flag	O
.	O
</s>
<s>
The	O
command-syntax	O
is	O
:	O
</s>
<s>
Concatenation	O
of	O
text	O
is	O
limited	O
to	O
text	O
files	O
using	O
the	O
same	O
legacy	O
encoding	O
,	O
such	O
as	O
ASCII	B-Protocol
.	O
</s>
<s>
Command	B-Application
Explanation	O
cat	O
file1.txt	O
Display	O
contents	O
of	O
file	O
cat	O
file1.txt	O
file2.txt	O
Concatenate	O
two	O
text	O
files	O
and	O
display	O
the	O
result	O
in	O
the	O
terminal	O
cat	O
file1.txt	O
file2.txt	O
>	O
newcombinedfile.txt	O
Concatenate	O
two	O
text	O
files	O
and	O
write	O
them	O
to	O
a	O
new	O
file	O
cat	O
>newfile.txt	O
Create	O
a	O
file	O
called	O
newfile.txt	O
.	O
</s>
<s>
cat	O
-n	O
file1.txt	O
file2.txt	O
>	O
newnumberedfile.txt	O
Some	O
implementations	O
of	O
cat	O
,	O
with	O
option	O
-n	O
,	O
can	O
also	O
number	O
lines	O
cat	O
file1.txt	O
>	O
file2.txt	O
Copy	O
the	O
contents	O
of	O
file1.txt	O
into	O
file2.txt	O
cat	O
file1.txt	O
>>	O
file2.txt	O
Append	O
the	O
contents	O
of	O
file1.txt	O
to	O
file2.txt	O
cat	O
file1.txt	O
file2.txt	O
file3.txt	O
|	O
sort	O
>	O
test4	O
Concatenate	O
the	O
files	O
,	O
sort	O
the	O
complete	O
set	O
of	O
lines	O
,	O
and	O
write	O
the	O
output	O
to	O
a	O
newly	O
created	O
file	O
cat	O
file1.txt	O
file2.txt	O
|	O
less	B-Application
Run	O
the	O
program	O
"	O
less	B-Application
"	O
with	O
the	O
concatenation	O
of	O
file1	O
and	O
file2	O
as	O
its	O
input	O
cat	O
file1.txt	O
|	O
grep	O
example	O
Highlight	O
instances	O
the	O
word	O
"	O
example	O
"	O
in	O
file1.txt	O
command	B-Application
|	O
cat	O
Cancel	O
"	O
command	B-Application
"	O
special	O
behavior	O
(	O
e.g.	O
</s>
<s>
Useless	O
use	O
of	O
cat	O
(	O
UUOC	O
)	O
is	O
common	O
Unix	B-Application
jargon	O
for	O
command	B-Application
line	O
constructs	O
that	O
only	O
provide	O
a	O
function	O
of	O
convenience	O
to	O
the	O
user	O
.	O
</s>
<s>
This	O
can	O
be	O
rewritten	O
using	O
redirection	B-Device
of	O
stdin	O
instead	O
,	O
in	O
either	O
of	O
the	O
following	O
forms	O
(	O
the	O
first	O
is	O
more	O
traditional	O
)	O
:	O
</s>
<s>
Beyond	O
other	O
benefits	O
,	O
the	O
input	O
redirection	B-Device
forms	O
allow	O
command	B-Application
to	O
perform	O
random	B-General_Concept
access	I-General_Concept
on	O
the	O
file	O
,	O
whereas	O
the	O
cat	O
examples	O
do	O
not	O
.	O
</s>
<s>
This	O
is	O
because	O
the	O
redirection	B-Device
form	O
opens	O
the	O
file	O
as	O
the	O
stdin	O
file	O
descriptor	O
which	O
command	B-Application
can	O
fully	O
access	O
,	O
while	O
the	O
cat	O
form	O
simply	O
provides	O
the	O
data	O
as	O
a	O
stream	O
of	O
bytes	O
.	O
</s>
<s>
Another	O
common	O
case	O
where	O
cat	O
is	O
unnecessary	O
is	O
where	O
a	O
command	B-Application
defaults	O
to	O
operating	O
on	O
stdin	O
,	O
but	O
will	O
read	O
from	O
a	O
file	O
,	O
if	O
the	O
filename	O
is	O
given	O
as	O
an	O
argument	O
.	O
</s>
<s>
Also	O
,	O
one	O
wrong	O
use	O
of	O
the	O
redirection	B-Device
symbol	O
""	O
instead	O
of	O
""	O
(	O
often	O
adjacent	O
on	O
keyboards	O
)	O
may	O
permanently	O
delete	O
the	O
content	O
of	O
a	O
file	O
,	O
in	O
other	O
words	O
clobbering	B-General_Concept
,	O
and	O
one	O
way	O
to	O
avoid	O
this	O
is	O
to	O
use	O
cat	O
with	O
pipes	O
.	O
</s>
