0
0
Linux CLIscripting~5 mins

tee for splitting output in Linux CLI - Cheat Sheet & Quick Revision

Choose your learning style9 modes available
Recall & Review
beginner
What does the tee command do in Linux?
The tee command reads from standard input and writes the output to both standard output (screen) and one or more files at the same time.
Click to reveal answer
beginner
How do you use tee to append output to a file instead of overwriting it?
Use the -a option with tee. For example: command | tee -a filename appends the output to filename.
Click to reveal answer
beginner
Why is tee useful when running commands in the terminal?
tee lets you see the output on the screen and save it to a file at the same time. This is like watching a live TV show while recording it for later.
Click to reveal answer
beginner
What happens if you run ls | tee file.txt?
The list of files from ls will be shown on the screen and also saved into file.txt. You get both at once.
Click to reveal answer
intermediate
Can tee write to multiple files at once? How?
Yes. You can list multiple files after tee. For example: command | tee file1.txt file2.txt writes the output to both files and the screen.
Click to reveal answer
What does the tee command do?
ASplits output to screen and file(s)
BDeletes files
CChanges file permissions
DCompresses files
How do you append output to a file using tee?
AUse <code>-d</code> option
BUse <code>-o</code> option
CUse <code>-a</code> option
DUse <code>-r</code> option
Which command shows output on screen and saves it to log.txt?
Acommand | tee log.txt
Bcommand > log.txt
Ccommand >> log.txt
Dtee command log.txt
Can tee write to multiple files at once?
ANo, it only writes to screen
BNo, only one file at a time
CYes, but only with <code>-m</code> option
DYes, by listing files after <code>tee</code>
What will ls | tee file.txt do?
AOnly save files to file.txt
BShow files on screen and save to file.txt
COnly show files on screen
DDelete file.txt
Explain how the tee command helps when you want to see command output and save it at the same time.
Think about watching and recording a live show.
You got /4 concepts.
    Describe how to use tee to append output to a file and why this might be useful.
    Appending is like adding pages to a notebook without erasing old pages.
    You got /4 concepts.