You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

18 lines
692 B
Plaintext

# Display `ls` output to the user, but also write it to the given file.
ls | tee outfile.txt
# As above, but append the data; previous file's data remains intact while
# new data is added at the end of the file.
ls | tee -a outfile.txt
# Pipe the standard output of a given command into `tee`, which then displays
# it to the user and sending the data to files `one`, `two`, and `three`.
[COMMAND] | tee one two three
# Workaround to output data to a file, with root privileges.
echo 3 | sudo tee /proc/sys/vm/drop_caches
# Pipe the current Vim buffer to a shell process, which in this case is `tee`.
# This is especially useful as a shortcut added to `.vimrc` or similar.
:w !sudo tee %