Text Processing

tee

Writes input to both a file and standard output.

tee lets you save pipeline output while still seeing it on screen.

Syntax
tee [options] file...

Arguments explained

  • file is where to write a copy.
  • -a appends instead of overwriting.

Common examples

Save and view output
dmesg | tee kernel.log | less

Writes dmesg to kernel.log and pages it.

Append with sudo
echo 'alias ll="ls -lah"' | tee -a ~/.bashrc

Appends a line while also printing it.

tee Command
FieldDetails
Commandtee
CategoryText Processing
Primary useWrites input to both a file and standard output.
Syntaxtee [options] file...