I have two commands say cmd1 and cmd2, wherein i perform
time cmd1 | cmd2
I want to get something like
cmd1 >> file.out and {time cmd1 >> file.out} | cmd2 >> file.out
so can someone suggest how it is actually done? edit: as Anthony's answer below suggests, tee works here but if i write
time cmd1 |tee -a file.out | cmd2 >> file.out
then it only writes the output of cmd1 to file.out and cmd2 to file.out, whereas i also want the output of {time cmd1} to that file.
I am using bash shell on Ubuntu Mate. If the time keyword complicates it, please suggest some method to time the execution and do the exact operation.