Custom Search

Friday, September 18, 2015

How to Linux show command output on terminal and save to a file at the same time

1)
Howto Linux print on terminal and write to a file simultaneously

$tail -f /var/log/upstart/ironic-api.log 2>&1 | tee a.txt

2)
Run command in watch mode and append output to a file and print in terminal

$watch "myscript.sh 2>&1 | tee -a mylog.txt"



No comments:

Post a Comment