<s>
In	O
computing	O
,	O
tee	B-Operating_System
is	O
a	O
command	B-Application
in	O
command-line	O
interpreters	O
(	O
shells	B-Operating_System
)	O
using	O
standard	B-Operating_System
streams	I-Operating_System
which	O
reads	O
standard	O
input	O
and	O
writes	O
it	O
to	O
both	O
standard	O
output	O
and	O
one	O
or	O
more	O
files	O
,	O
effectively	O
duplicating	O
its	O
input	O
.	O
</s>
<s>
It	O
is	O
primarily	O
used	O
in	O
conjunction	O
with	O
pipes	B-Operating_System
and	O
filters	O
.	O
</s>
<s>
The	O
command	B-Application
is	O
named	O
after	O
the	O
T-splitter	O
used	O
in	O
plumbing	O
.	O
</s>
<s>
The	O
tee	B-Operating_System
command	B-Application
is	O
normally	O
used	O
to	O
split	O
the	O
output	O
of	O
a	O
program	O
so	O
that	O
it	O
can	O
be	O
both	O
displayed	O
and	O
saved	O
in	O
a	O
file	O
.	O
</s>
<s>
The	O
command	B-Application
can	O
be	O
used	O
to	O
capture	O
intermediate	O
output	O
before	O
the	O
data	O
is	O
altered	O
by	O
another	O
command	B-Application
or	O
program	O
.	O
</s>
<s>
The	O
tee	B-Operating_System
command	B-Application
reads	O
standard	O
input	O
,	O
then	O
writes	O
its	O
content	O
to	O
standard	O
output	O
.	O
</s>
<s>
The	O
syntax	O
differs	O
depending	O
on	O
the	O
command	B-Application
's	O
implementation	O
.	O
</s>
<s>
The	O
command	B-Application
is	O
available	O
for	O
Unix	B-Application
and	O
Unix-like	B-Operating_System
operating	I-Operating_System
systems	I-Operating_System
,	O
Microware	B-Operating_System
OS-9	B-Operating_System
,	O
DOS	B-Device
(	O
e.g.	O
</s>
<s>
4DOS	B-Application
,	O
FreeDOS	B-Application
)	O
,	O
Microsoft	B-Application
Windows	I-Application
(	O
e.g.	O
</s>
<s>
4NT	B-Application
,	O
Windows	B-Application
PowerShell	I-Application
)	O
,	O
and	O
ReactOS	B-Application
.	O
</s>
<s>
The	O
Linux	O
tee	B-Operating_System
command	B-Application
was	O
written	O
by	O
Mike	O
Parker	O
,	O
Richard	O
Stallman	O
,	O
and	O
David	O
MacKenzie	O
.	O
</s>
<s>
The	O
command	B-Application
is	O
available	O
as	O
a	O
separate	O
package	O
for	O
Microsoft	B-Application
Windows	I-Application
as	O
part	O
of	O
the	O
UnxUtils	B-Application
collection	O
of	O
native	B-Language
Win32	B-Library
ports	O
of	O
common	O
GNU	O
Unix-like	B-Operating_System
utilities	O
.	O
</s>
<s>
The	O
FreeDOS	B-Application
version	O
was	O
developed	O
by	O
Jim	O
Hall	O
and	O
is	O
licensed	O
under	O
the	O
GPL	B-License
.	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>
Additionally	O
the	O
sponge	O
command	B-Application
offers	O
similar	O
capabilities	O
.	O
</s>
<s>
The	O
command	B-Application
returns	O
the	O
following	O
exit	O
values	O
(	O
exit	B-Operating_System
status	I-Operating_System
)	O
:	O
</s>
<s>
Using	O
process	B-Device
substitution	I-Device
lets	O
more	O
than	O
one	O
process	O
read	O
the	O
standard	O
output	O
of	O
the	O
originating	O
process	O
.	O
</s>
<s>
TEE	B-Operating_System
 [ /A ] 	O
file	O
...	O
</s>
<s>
file	O
One	O
or	O
more	O
files	O
that	O
will	O
receive	O
the	O
"	O
tee	B-Operating_System
'd	O
"	O
output	O
.	O
</s>
<s>
/A	O
Append	O
the	O
pipeline	B-Operating_System
content	O
to	O
the	O
output	O
file(s )	O
rather	O
than	O
overwriting	O
them	O
.	O
</s>
<s>
Note	O
:	O
When	O
tee	B-Operating_System
is	O
used	O
with	O
a	O
pipe	O
,	O
the	O
output	O
of	O
the	O
previous	O
command	B-Application
is	O
written	O
to	O
a	O
temporary	B-Application
file	I-Application
.	O
</s>
<s>
When	O
that	O
command	B-Application
finishes	O
,	O
tee	B-Operating_System
reads	O
the	O
temporary	B-Application
file	I-Application
,	O
displays	O
the	O
output	O
,	O
and	O
writes	O
it	O
to	O
the	O
file(s )	O
given	O
as	O
command-line	O
argument	O
.	O
</s>
<s>
The	O
parameter	O
accepts	O
wildcard	B-Algorithm
characters	I-Algorithm
that	O
resolve	O
to	O
a	O
single	O
file	O
.	O
</s>
<s>
Note	O
:	O
tee	B-Operating_System
is	O
implemented	O
as	O
a	O
ReadOnly	O
command	B-Device
alias	I-Device
.	O
</s>
<s>
The	O
internal	O
cmdlet	O
name	O
is	O
Microsoft.PowerShell.Utility	O
\Tee-Object	O
.	O
</s>
<s>
To	O
view	O
and	O
save	O
the	O
output	O
from	O
a	O
command	B-Application
(	O
lint	B-Device
)	O
at	O
the	O
same	O
time	O
:	O
</s>
<s>
This	O
displays	O
the	O
standard	O
output	O
of	O
the	O
command	B-Application
lint	B-Device
program.c	O
at	O
the	O
computer	O
,	O
and	O
at	O
the	O
same	O
time	O
saves	O
a	O
copy	O
of	O
it	O
in	O
the	O
file	O
program.lint	O
.	O
</s>
<s>
If	O
a	O
file	O
named	O
program.lint	O
already	O
exists	O
,	O
it	O
is	O
deleted	O
and	O
replaced	O
.	O
</s>
<s>
Similarly	O
,	O
both	O
the	O
stdout	O
and	O
stderr	O
output	O
streams	O
can	O
be	O
redirected	O
to	O
standard	O
output	O
and	O
the	O
program.lint	O
using	O
stream	O
redirection	O
:	O
</s>
<s>
To	O
view	O
and	O
append	O
the	O
output	O
from	O
a	O
command	B-Application
to	O
an	O
existing	O
file	O
:	O
</s>
<s>
This	O
displays	O
the	O
standard	O
output	O
of	O
the	O
lint	B-Device
program.c	O
command	B-Application
at	O
the	O
computer	O
and	O
at	O
the	O
same	O
time	O
appends	O
a	O
copy	O
of	O
it	O
to	O
the	O
end	O
of	O
the	O
program.lint	O
file	O
.	O
</s>
<s>
If	O
the	O
program.lint	O
file	O
does	O
not	O
exist	O
,	O
it	O
is	O
created	O
.	O
</s>
<s>
This	O
example	O
shows	O
tee	B-Operating_System
being	O
used	O
to	O
bypass	O
an	O
inherent	O
limitation	O
in	O
the	O
sudo	B-Device
command	B-Application
.	O
</s>
<s>
sudo	B-Device
is	O
unable	O
to	O
pipe	O
the	O
standard	O
output	O
to	O
a	O
file	O
.	O
</s>
<s>
The	O
command	B-Application
above	O
gives	O
the	O
current	O
user	O
root	O
access	O
to	O
a	O
server	O
over	O
ssh	O
,	O
by	O
installing	O
the	O
user	O
's	O
public	O
key	O
to	O
the	O
server	O
's	O
key	O
authorization	O
list	O
.	O
</s>
<s>
In	O
Bash	B-Operating_System
,	O
the	O
output	O
can	O
be	O
filtered	B-Application
before	O
being	O
written	O
to	O
the	O
file	O
—	O
without	O
affecting	O
the	O
output	O
displayed	O
—	O
by	O
using	O
process	B-Device
substitution	I-Device
.	O
</s>
<s>
removes	O
common	O
ANSI	O
escape	O
codes	O
before	O
writing	O
to	O
ls.txt	O
,	O
but	O
retains	O
them	O
for	O
display	O
.	O
</s>
<s>
This	O
example	O
searches	O
the	O
file	O
wikipedia.txt	O
for	O
any	O
lines	O
containing	O
the	O
string	O
"	O
4DOS	B-Application
"	O
,	O
makes	O
a	O
copy	O
of	O
the	O
matching	O
lines	O
in	O
4DOS.txt	O
,	O
sorts	O
the	O
lines	O
,	O
and	O
writes	O
them	O
to	O
the	O
output	O
file	O
4DOSsorted.txt	O
:	O
</s>
<s>
To	O
view	O
and	O
save	O
the	O
output	O
from	O
a	O
command	B-Application
at	O
the	O
same	O
time	O
:	O
</s>
<s>
This	O
displays	O
the	O
standard	O
output	O
of	O
the	O
command	B-Application
ipconfig	O
at	O
the	O
console	B-Application
window	I-Application
,	O
and	O
simultaneously	O
saves	O
a	O
copy	O
of	O
it	O
in	O
the	O
file	O
OutputFile.txt	O
.	O
</s>
<s>
To	O
display	O
and	O
save	O
all	O
running	O
processes	B-Operating_System
,	O
filtered	B-Application
so	O
that	O
only	O
programs	O
starting	O
with	O
svc	O
and	O
owning	O
more	O
than	O
1000	O
handles	O
are	O
output	O
:	O
</s>
<s>
This	O
example	O
shows	O
that	O
the	O
piped	O
input	O
for	O
tee	B-Operating_System
can	O
be	O
filtered	B-Application
and	O
that	O
tee	B-Operating_System
is	O
used	O
to	O
display	O
that	O
output	O
,	O
which	O
is	O
filtered	B-Application
again	O
so	O
that	O
only	O
processes	B-Operating_System
owning	O
more	O
than	O
1000	O
handles	O
are	O
displayed	O
,	O
and	O
writes	O
the	O
unfiltered	O
output	O
to	O
the	O
file	O
ABC.txt	O
.	O
</s>
<s>
Windows	B-Application
Powershell	I-Application
is	O
not	O
suitable	O
for	O
binary	O
and	O
raw	O
data	O
and	O
will	O
always	O
treat	O
the	O
stream	O
as	O
text	O
and	O
will	O
modify	O
the	O
data	O
as	O
it	O
is	O
transferred	O
.	O
</s>
