tee
Read from standard input and write to standard output and files
Overview
The `tee` command copies standard input to standard output, making a copy in zero or more files. The output is unbuffered.
Syntax
tee [OPTION]... [FILE]...Common Options
-a, --appendAppend to the given FILEs, do not overwrite.
-i, --ignore-interruptsIgnore interrupt signals (like Ctrl+C).
-pDiagnose errors writing to non-pipeline outputs.
--output-error[=MODE]Set behavior on write error. MODE can be: warn (default), warn-nopipe, exit, exit-nopipe.
--helpDisplay help and exit.
--versionOutput version information and exit.
Examples
Displays the long listing of files and simultaneously saves it to `directory_listing.txt`.
Appends the message to `application.log` and prints it to the terminal.
Duplicates `script.sh` to `script.backup.sh` and then executes the original script content passed through `tee`.
Appends the current date and time to both `current_time.txt` and `log_file.txt`, and also displays it.
Redirects both stdout and stderr of `some_command` to `tee`, which then writes to `output_and_errors.log` and stdout.