[LINUX] tee

Greedy command

I want to output the command result as standard, and also output it to a file Commands that can be used when you want to

Execution example
echo "Can be displayed in either" | tee test1.txt

The one that saves the standard output error and uses it when displayed on the screen

ping host8888 2>&1 | tee pinglog.txt
 ping: unknown host host8888
cat pinglog.txt 
 ping: unknown host host1234

If you add -a, you can add it without overwriting.

tee [option]file name

Recommended Posts