Linux Tee Command Tutorial with Examples For Stdout Management

RSS
EMAIL
FACEBOOK
FACEBOOK
GOOGLE
GOOGLE
https://www.poftut.com/linux-tee-command-tutorial-examples-stdout-management/
PINTEREST
PINTEREST
INSTAGRAM

Linux and Unix operating systems mainly managed through command line interface. For complex situations we generally run multiple commands where each command’s output can be input of other commands. Linux provides very useful tool named tee which provides some flexibility while redirecting command outputs.

Write Output To A File

One of the most popular use case of tee command is writing command outputs into a file. In this case we will write ls / command output into file nameddirlist and also print output to the terminal.

Write Output To A File
Write Output To A File

Append Output To A File

In previous example we have created a file and added provided output. Default behaviour is overwriting to the given file. But in some situations we need to append to the file. We can provide -a option which will append to the given file.

Write Output Multiple Files

We have the ability to write output multiple files. In this example we will write output to the files named f1 , f2 , f3 , … . We can also add more files.

Ignore Interrupts

What if there is an interrupt against tee . By default the operation and command execution will be finished. We can ignore these interrupts with -i option like below.

RSS
EMAIL
FACEBOOK
FACEBOOK
GOOGLE
GOOGLE
https://www.poftut.com/linux-tee-command-tutorial-examples-stdout-management/
PINTEREST
PINTEREST
INSTAGRAM

LEARN MORE  What is Microsoft Powershell ? How Can I Automate Tasks?

Leave a Reply

Your email address will not be published.