Linux tee Command
The Linux tee command is used to read data from standard input and write it to a file.
The tee command reads data from the standard input device, outputs it to the standard output device, and also saves it as a file.
Syntax
tee [-ai][--help][--version][file...]
Parameters:
-a or --append: Append to an existing file instead of overwriting it.
-i or --ignore-interrupts: Ignore interrupt signals.
--help: Display online help.
--version: Show version information.
Example
Use the "tee" command to save user input data to both "file1" and "file2" files, with the following command:
$ tee file1 file2 # Copy content to two files
After executing the above command, it will prompt the user to input data to be saved to the files, as shown below:
My Linux # Prompt for user input
My Linux # Output data, providing feedback
At this point, you can open both "file1" and "file2" to check if their content is "My Linux" to determine if the "tee" command was executed successfully.