Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to redirect the output to two different files when two command are involved simultaneously?

Tags:

unix

perf

I am using perf tool to analyze sort utility . I gave following command.

perf stat -x, ../bin/sort data >/dev/null 2>perf_data

I want to redirect the output of sort to /dev/null and output of perf to perf_data file.

How can I Do this ?

like image 955
Abhishek Gupta Avatar asked Jan 27 '26 09:01

Abhishek Gupta


1 Answers

Actually you can put it in parenthesis. Following command has worked for me.

(perf stat -x, ../bin/sort data >/dev/null) 2>perfoutput.txt
like image 82
user1800354 Avatar answered Jan 31 '26 15:01

user1800354



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!