tee
ShellFundamentals In simulator In real LinuxCopy input to files and to the screen
Name: tee: like a T-shaped pipe fitting (one in, two out)
You can practise it right away in the simulator, and use it in real Linux mode too.
Description
tee copies standard input to standard output and to one or more files, like a T fitting in a pipe, so you can save data while passing it on.
A common trick: echo "..." | sudo tee /etc/somefile writes a root-owned file, because in sudo echo ... > file the redirection does not run as root.
Syntax
tee [OPTION]... [FILE]...Common options
| -a / --append | Append instead of overwriting |
| -i / --ignore-interrupts | Ignore Ctrl+C |