Search code examples
bashstdoutstderr

How do I save terminal output into a log file?


I'm running ycsb, which sends workload generated by YCSB to mongodb and it has a standard output, which I am storing in the file outputLoad.

./bin/ycsb load mongodb -s -P workloads/workloada -p mongodb.database=ycsb > outputLoad

The -s parameter in the command tells it to generate a client report status. The report status is printed directly to my terminal. How can I get this status into a log file?


Solution

  • Redirect standard error (file descriptor 2) to a file.

    ./bin/ycsb [...options...] > outputLoad 2> mylog.log