Linux Tee command examples

Linux Tee command examples.

In Linux Tee is a command to redirect standard out (stdout) to a file as well as the terminal.

Tee redirects to the terminal as well as to standard out (stdout) so its activity can be visual as well as redirected to a log file, for later viewing. Using yum in this example and compiling from source and a way of keeping track of updates. (The default yum log should do this but just an example). If you are compiling from source this could be invaluable as nothing keeps track off compiled packages (check install is an exception).

yum update -y | tee yumupdate.txt

An example compiling from source.

This example assumes you have all the dependencies, but you can check the logs outputted by tee for dependency errors.

Youve downloaded the needed source and you have cd into that directory.

./configure | tee configure.txt
make | tee make.txt
make install | tee install.txt

This can help if any of the outputs overrun your terminal buffer and you cant scroll back to see enough but also a log you can look back to incase of any future issues, you can check the configure make and install files for any errors as well as where the files were installed to.

Bash Scripting, Linux

Leave a Reply

Your email address will not be published. Required fields are marked *

five × three =