What is the difference (if any) between âcat input | tee > outputâ and âtee outputâ?
Clash Royale CLAN TAG#URR8PPP
.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty margin-bottom:0;
up vote
-2
down vote
favorite
I obtained the following:
$ time $(tee < infile > outfile)
real 0m14.721s
user 0m0.094s
sys 0m2.629s
$ time $(cat infile | tee > outfile)
real 0m8.931s
user 0m0.123s
sys 0m3.168
Is that difference just owing to redirection/piping, or is there something else going on here? Running them a second time gave the following:
$ time $(tee < infile > outfile)
real 0m11.558
user 0m0.113s
sys 0m2.691s
$ time $(cat infile | tee > outfile)
real 0m8.822s
user 0m0.120s
sys 0m3.125s
PS: Both infile and outfile were mp4 files, cached in ram; if that makes any difference.
Edit: I meant tee < infile > outfile
and not tee < infile tee > outfile
.
bash files cat tee
add a comment |Â
up vote
-2
down vote
favorite
I obtained the following:
$ time $(tee < infile > outfile)
real 0m14.721s
user 0m0.094s
sys 0m2.629s
$ time $(cat infile | tee > outfile)
real 0m8.931s
user 0m0.123s
sys 0m3.168
Is that difference just owing to redirection/piping, or is there something else going on here? Running them a second time gave the following:
$ time $(tee < infile > outfile)
real 0m11.558
user 0m0.113s
sys 0m2.691s
$ time $(cat infile | tee > outfile)
real 0m8.822s
user 0m0.120s
sys 0m3.125s
PS: Both infile and outfile were mp4 files, cached in ram; if that makes any difference.
Edit: I meant tee < infile > outfile
and not tee < infile tee > outfile
.
bash files cat tee
Note: no need for$()
it will result in output being thrown away, andtime
does not need it.()
would be good though.
â ctrl-alt-delor
Jul 28 at 10:17
You just edited the commands, but leave the timings for the old commands. â¹ (-1)
â ctrl-alt-delor
Jul 28 at 10:46
.. because that was the result I obtained ... I had made the mistake in the body.
â Shubham1999
Jul 28 at 11:00
I did not believe you so, I have just repeated the experiment. The one withcat
is slower. I still don't believe you.
â ctrl-alt-delor
Jul 28 at 11:20
Why do you time the result of executing the output of those commands?
â Kusalananda
Jul 28 at 11:44
add a comment |Â
up vote
-2
down vote
favorite
up vote
-2
down vote
favorite
I obtained the following:
$ time $(tee < infile > outfile)
real 0m14.721s
user 0m0.094s
sys 0m2.629s
$ time $(cat infile | tee > outfile)
real 0m8.931s
user 0m0.123s
sys 0m3.168
Is that difference just owing to redirection/piping, or is there something else going on here? Running them a second time gave the following:
$ time $(tee < infile > outfile)
real 0m11.558
user 0m0.113s
sys 0m2.691s
$ time $(cat infile | tee > outfile)
real 0m8.822s
user 0m0.120s
sys 0m3.125s
PS: Both infile and outfile were mp4 files, cached in ram; if that makes any difference.
Edit: I meant tee < infile > outfile
and not tee < infile tee > outfile
.
bash files cat tee
I obtained the following:
$ time $(tee < infile > outfile)
real 0m14.721s
user 0m0.094s
sys 0m2.629s
$ time $(cat infile | tee > outfile)
real 0m8.931s
user 0m0.123s
sys 0m3.168
Is that difference just owing to redirection/piping, or is there something else going on here? Running them a second time gave the following:
$ time $(tee < infile > outfile)
real 0m11.558
user 0m0.113s
sys 0m2.691s
$ time $(cat infile | tee > outfile)
real 0m8.822s
user 0m0.120s
sys 0m3.125s
PS: Both infile and outfile were mp4 files, cached in ram; if that makes any difference.
Edit: I meant tee < infile > outfile
and not tee < infile tee > outfile
.
bash files cat tee
edited Jul 28 at 10:24
asked Jul 28 at 9:45
Shubham1999
12
12
Note: no need for$()
it will result in output being thrown away, andtime
does not need it.()
would be good though.
â ctrl-alt-delor
Jul 28 at 10:17
You just edited the commands, but leave the timings for the old commands. â¹ (-1)
â ctrl-alt-delor
Jul 28 at 10:46
.. because that was the result I obtained ... I had made the mistake in the body.
â Shubham1999
Jul 28 at 11:00
I did not believe you so, I have just repeated the experiment. The one withcat
is slower. I still don't believe you.
â ctrl-alt-delor
Jul 28 at 11:20
Why do you time the result of executing the output of those commands?
â Kusalananda
Jul 28 at 11:44
add a comment |Â
Note: no need for$()
it will result in output being thrown away, andtime
does not need it.()
would be good though.
â ctrl-alt-delor
Jul 28 at 10:17
You just edited the commands, but leave the timings for the old commands. â¹ (-1)
â ctrl-alt-delor
Jul 28 at 10:46
.. because that was the result I obtained ... I had made the mistake in the body.
â Shubham1999
Jul 28 at 11:00
I did not believe you so, I have just repeated the experiment. The one withcat
is slower. I still don't believe you.
â ctrl-alt-delor
Jul 28 at 11:20
Why do you time the result of executing the output of those commands?
â Kusalananda
Jul 28 at 11:44
Note: no need for
$()
it will result in output being thrown away, and time
does not need it. ()
would be good though.â ctrl-alt-delor
Jul 28 at 10:17
Note: no need for
$()
it will result in output being thrown away, and time
does not need it. ()
would be good though.â ctrl-alt-delor
Jul 28 at 10:17
You just edited the commands, but leave the timings for the old commands. â¹ (-1)
â ctrl-alt-delor
Jul 28 at 10:46
You just edited the commands, but leave the timings for the old commands. â¹ (-1)
â ctrl-alt-delor
Jul 28 at 10:46
.. because that was the result I obtained ... I had made the mistake in the body.
â Shubham1999
Jul 28 at 11:00
.. because that was the result I obtained ... I had made the mistake in the body.
â Shubham1999
Jul 28 at 11:00
I did not believe you so, I have just repeated the experiment. The one with
cat
is slower. I still don't believe you.â ctrl-alt-delor
Jul 28 at 11:20
I did not believe you so, I have just repeated the experiment. The one with
cat
is slower. I still don't believe you.â ctrl-alt-delor
Jul 28 at 11:20
Why do you time the result of executing the output of those commands?
â Kusalananda
Jul 28 at 11:44
Why do you time the result of executing the output of those commands?
â Kusalananda
Jul 28 at 11:44
add a comment |Â
1 Answer
1
active
oldest
votes
up vote
1
down vote
accepted
The examples are not the same as in the title.
For the question in the title.
The version with cat will be marginally slower.
For the question in the body
The first command, is writing two files. This is why is is slower.
The second is starting an extra process (cat
), but this is a small slowdown compared to writing extra file.
The second run is faster, probably, because the read is cached.
Explenation
tee < infile tee > outfile
is functionally equivalent, but faster than cat infile | tee tee > outfile
, where as tee > outfile
is not. The first two produce two file, the 3rd produces one, so will be faster.
Look againtee > outfile
it only has one output.
â ctrl-alt-delor
Jul 28 at 10:16
Thanks for pointing out! Sorry, I had written it wrongly; but I checked my history - the title is what I meant.
â Shubham1999
Jul 28 at 10:26
add a comment |Â
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
up vote
1
down vote
accepted
The examples are not the same as in the title.
For the question in the title.
The version with cat will be marginally slower.
For the question in the body
The first command, is writing two files. This is why is is slower.
The second is starting an extra process (cat
), but this is a small slowdown compared to writing extra file.
The second run is faster, probably, because the read is cached.
Explenation
tee < infile tee > outfile
is functionally equivalent, but faster than cat infile | tee tee > outfile
, where as tee > outfile
is not. The first two produce two file, the 3rd produces one, so will be faster.
Look againtee > outfile
it only has one output.
â ctrl-alt-delor
Jul 28 at 10:16
Thanks for pointing out! Sorry, I had written it wrongly; but I checked my history - the title is what I meant.
â Shubham1999
Jul 28 at 10:26
add a comment |Â
up vote
1
down vote
accepted
The examples are not the same as in the title.
For the question in the title.
The version with cat will be marginally slower.
For the question in the body
The first command, is writing two files. This is why is is slower.
The second is starting an extra process (cat
), but this is a small slowdown compared to writing extra file.
The second run is faster, probably, because the read is cached.
Explenation
tee < infile tee > outfile
is functionally equivalent, but faster than cat infile | tee tee > outfile
, where as tee > outfile
is not. The first two produce two file, the 3rd produces one, so will be faster.
Look againtee > outfile
it only has one output.
â ctrl-alt-delor
Jul 28 at 10:16
Thanks for pointing out! Sorry, I had written it wrongly; but I checked my history - the title is what I meant.
â Shubham1999
Jul 28 at 10:26
add a comment |Â
up vote
1
down vote
accepted
up vote
1
down vote
accepted
The examples are not the same as in the title.
For the question in the title.
The version with cat will be marginally slower.
For the question in the body
The first command, is writing two files. This is why is is slower.
The second is starting an extra process (cat
), but this is a small slowdown compared to writing extra file.
The second run is faster, probably, because the read is cached.
Explenation
tee < infile tee > outfile
is functionally equivalent, but faster than cat infile | tee tee > outfile
, where as tee > outfile
is not. The first two produce two file, the 3rd produces one, so will be faster.
The examples are not the same as in the title.
For the question in the title.
The version with cat will be marginally slower.
For the question in the body
The first command, is writing two files. This is why is is slower.
The second is starting an extra process (cat
), but this is a small slowdown compared to writing extra file.
The second run is faster, probably, because the read is cached.
Explenation
tee < infile tee > outfile
is functionally equivalent, but faster than cat infile | tee tee > outfile
, where as tee > outfile
is not. The first two produce two file, the 3rd produces one, so will be faster.
edited Jul 28 at 10:16
answered Jul 28 at 10:04
ctrl-alt-delor
8,54031946
8,54031946
Look againtee > outfile
it only has one output.
â ctrl-alt-delor
Jul 28 at 10:16
Thanks for pointing out! Sorry, I had written it wrongly; but I checked my history - the title is what I meant.
â Shubham1999
Jul 28 at 10:26
add a comment |Â
Look againtee > outfile
it only has one output.
â ctrl-alt-delor
Jul 28 at 10:16
Thanks for pointing out! Sorry, I had written it wrongly; but I checked my history - the title is what I meant.
â Shubham1999
Jul 28 at 10:26
Look again
tee > outfile
it only has one output.â ctrl-alt-delor
Jul 28 at 10:16
Look again
tee > outfile
it only has one output.â ctrl-alt-delor
Jul 28 at 10:16
Thanks for pointing out! Sorry, I had written it wrongly; but I checked my history - the title is what I meant.
â Shubham1999
Jul 28 at 10:26
Thanks for pointing out! Sorry, I had written it wrongly; but I checked my history - the title is what I meant.
â Shubham1999
Jul 28 at 10:26
add a comment |Â
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f459023%2fwhat-is-the-difference-if-any-between-cat-input-tee-output-and-tee-in%23new-answer', 'question_page');
);
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Note: no need for
$()
it will result in output being thrown away, andtime
does not need it.()
would be good though.â ctrl-alt-delor
Jul 28 at 10:17
You just edited the commands, but leave the timings for the old commands. â¹ (-1)
â ctrl-alt-delor
Jul 28 at 10:46
.. because that was the result I obtained ... I had made the mistake in the body.
â Shubham1999
Jul 28 at 11:00
I did not believe you so, I have just repeated the experiment. The one with
cat
is slower. I still don't believe you.â ctrl-alt-delor
Jul 28 at 11:20
Why do you time the result of executing the output of those commands?
â Kusalananda
Jul 28 at 11:44