I am trying to throw command output to file plus console also. This is because i want to keep record of output in file. I am doing following and it appending to file but not printing ls
output on terminal.
$ls 2>&1 > /tmp/ls.txt
Redirecting output to Multiple files and screen: If you want to redirect the screen output to multiple files, the only thing you have to do is add the file names at the end of the tee command.
the shortcut is Ctrl + Shift + S ; it allows the output to be saved as a text file, or as HTML including colors!
The tee command, used with a pipe, reads standard input, then writes the output of a program to standard output and simultaneously copies it into the specified file or files. Use the tee command to view your output immediately and at the same time, store it for future use.
Yes, if you redirect the output, it won't appear on the console. Use tee
.
ls 2>&1 | tee /tmp/ls.txt
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With