Comments on: How to Use ‘tee’ Command in Linux [8 Useful Examples] https://www.tecmint.com/tee-command-examples/ Tecmint - Linux Howtos, Tutorials, Guides, News, Tips and Tricks. Fri, 14 Jul 2023 04:30:38 +0000 hourly 1 By: dragonmouth https://www.tecmint.com/tee-command-examples/comment-page-1/#comment-1972028 Fri, 24 Feb 2023 16:34:54 +0000 https://www.tecmint.com/?p=49570#comment-1972028 What is a practical application for #8 other than to demonstrate the use of the ‘tee’ command?

]]>
By: Narendra Kangralkar https://www.tecmint.com/tee-command-examples/comment-page-1/#comment-1970476 Wed, 22 Feb 2023 14:12:38 +0000 https://www.tecmint.com/?p=49570#comment-1970476 Hello @LV,

In the 7th example, we have used the combination of the Vim and Shell commands.

In this example:

:w is a Vim command which writes buffer contents to the file.
! is also a Vim command and it’s used to execute the shell command.
% is a Vim register that represents the current file. In this case, it will be output.txt.

So in a nutshell, we are using the tee command to redirect the output of the :w command to the current file i.e. output.txt. In this case, the file is owned by the root user. Hence we have to use the combination of the sudo and tee commands.

For the 8th example, let’s understand the command behavior without the -i option. First, let’s use the tee command without any arguments:

[tecmint@tecmint]$ tee

In this case, the command will read the input from the standard input and will display it on the standard output. At any time, we can use the ctrl+C key combination to terminate the command execution. This happens because the default behavior of the SIGINT signal is to terminate the process.

However, the same key combination will not work if we disable the interrupts using the -i option. In that case, we have to use the ctrl+D key combination to stop the command execution:

[tecmint@tecmint]$ tee -i

This option plays an important role when we want to redirect the continuous stream without interruption.

Just like other examples, we can also use the file names with this option.

]]>
By: LV https://www.tecmint.com/tee-command-examples/comment-page-1/#comment-1970164 Wed, 22 Feb 2023 04:17:13 +0000 https://www.tecmint.com/?p=49570#comment-1970164 Thanks for this article, it is helpful. Regarding points 7 and 8 suppose you could explain the need for the action and its syntax a bit further.

]]>