Comments on: How to Pipe Command Output to Other Commands in Linux https://www.tecmint.com/pipe-command-output-to-other-commands/ Tecmint - Linux Howtos, Tutorials, Guides, News, Tips and Tricks. Wed, 31 Jul 2024 04:57:45 +0000 hourly 1 By: Ravi Saive https://www.tecmint.com/pipe-command-output-to-other-commands/comment-page-1/#comment-2196963 Wed, 31 Jul 2024 04:57:45 +0000 https://www.tecmint.com/?p=27511#comment-2196963 In reply to David Webb.

@David,

You’re absolutely right!

The tee command is particularly useful when you want to direct output to multiple files at once or also display it on the terminal while saving it to a file.

For a simple case where you only need to save output to one file, redirection with > or >> works just fine.

]]>
By: David Webb https://www.tecmint.com/pipe-command-output-to-other-commands/comment-page-1/#comment-2196700 Tue, 30 Jul 2024 13:14:38 +0000 https://www.tecmint.com/?p=27511#comment-2196700 I see a lot of articles explaining the tee command the way you did, but why use tee like this?

Your code example:

ps -eo cmd,pid,ppid,%mem,%cpu --sort=-%mem | head | tee topprocs.txt

could just as easily use redirection instead of tee:

ps -eo cmd,pid,ppid,%mem,%cpu --sort=-%mem | head > topprocs.txt

Use >> for appending.

In my opinion, tee is useful if you need to send the same output to multiple files simultaneously:

ps -eo cmd,pid,ppid,%mem,%cpu --sort=-%mem | head | tee topprocs1.txt topprocs2.txt

and so on.

]]>
By: Ravi Saive https://www.tecmint.com/pipe-command-output-to-other-commands/comment-page-1/#comment-2025450 Mon, 12 Jun 2023 04:21:32 +0000 https://www.tecmint.com/?p=27511#comment-2025450 In reply to Pavel Vachek.

@Pavel,

Thanks, corrected the command in the article…

]]>
By: Pavel Vachek https://www.tecmint.com/pipe-command-output-to-other-commands/comment-page-1/#comment-2025306 Sun, 11 Jun 2023 19:17:09 +0000 https://www.tecmint.com/?p=27511#comment-2025306 “Tree – Send Command Output to Other Command and Save to File”

I think that the first word in the title should read “Tee“, not “Tree“.

]]>