🖥️tee

➡️This is a command-line reference manual for commands and command combinations that you don’t use often enough to remember it. This cheatsheet explains the tee command with important options and switches using examples.

▁ ▂ ▃ ▄ ꧁ 🔴☠ COMMANDLINE-KUNGFU WITH CHEATSHEETS ☠🔴꧂▅ ▃ ▂ ▁

#                ████████╗███████╗███████╗
#                ╚══██╔══╝██╔════╝██╔════╝
#                   ██║   █████╗  █████╗  
#                   ██║   ██╔══╝  ██╔══╝  
#                   ██║   ███████╗███████╗
#                   ╚═╝   ╚══════╝╚══════╝
                                         
                                         
                                         

tee
    T

    The tee command is named after plumbing terminology for a T-shaped pipe splitter. This Unix command splits the output of another command, sending it to a file and to the terminal.

# To tee stdout to a file:
ls | tee outfile.txt

# To tee stdout and append to a file:
ls | tee -a outfile.txt

# tee would take the output of the first command in the pipeline and copy it 
# to standard output (the terminal) while also making copies of it in the files one, two and three:
somecommand | tee one two three

# write 3 to /proc/sys/vm/drop_caches (with root rights)
echo 3 | sudo tee /proc/sys/vm/drop_caches

# in Vim:
# The structure :w !cmd means "write the current buffer piped through command".
:w !sudo tee %

#==============================##==============================#
# CMD TEE						       #
#==============================##==============================#
░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░

  █║▌│║█║▌★ KALI ★ PARROT ★ DEBIAN 🔴 PENTESTING ★ HACKING ★ █║▌│║█║▌

              ██╗ ██╗ ██████╗  ██████╗ ██╗  ██╗███████╗██████╗
             ████████╗██╔══██╗██╔═══██╗╚██╗██╔╝██╔════╝██╔══██╗
             ╚██╔═██╔╝██║  ██║██║   ██║ ╚███╔╝ █████╗  ██║  ██║
             ████████╗██║  ██║██║   ██║ ██╔██╗ ██╔══╝  ██║  ██║
             ╚██╔═██╔╝██████╔╝╚██████╔╝██╔╝ ██╗███████╗██████╔╝
              ╚═╝ ╚═╝ ╚═════╝  ╚═════╝ ╚═╝  ╚═╝╚══════╝╚═════╝

               █║▌│║█║▌ WITH COMMANDLINE-KUNGFU POWER █║▌│║█║▌

░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░