mirror of
https://github.com/chubin/cheat.sheets
synced 2024-11-17 09:25:32 +00:00
15f7213025
intact is not hyphenated. Newline for formatting.
18 lines
692 B
Plaintext
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 %
|