Proxmox

Learn the tee Command in Linux: Redirect and Log Output Easily



The Linux Crash Course series on Learn Linux TV will teach you an important Linux-related skill or concept in each video. In this …

[ad_2]

source

Related Articles

20 Comments

  1. An essential use for the tee command instead of output redirection is when you want to modify a file that requires root privileges, especially from within scripts.

    For example, sudo echo 'Hello World' >> /tmp/example/root_file.conf will not work, returns permission denied, but this will echo 'Hello World' | sudo tee –append /tmp/example/root_file.conf

    If you do not use the tee command then you'll have to login into a root shell to properly execute the first command.

    If you know of any other or easier way please share.

  2. The tee command is deceptively simple. As another commenter mentioned, this tutorial does not mention the most common use case when the tee is in the middle of a pipeline, not at the end.

    On top of that, the impact of such use on performance is often underestimated with large files. The pipeline's property is that each link (pipe) a blocking 4 x 16K total 64k set of buffers. That may hit your performance hard and create wanted or unwanted backpressure.

    Some more info at https://blog.didenko.com/2012/09/tee.html

  3. Just finished watching your video, and do not know how I would use the tee command feature. You might consider giving some practical examples to how a typical Linux User might incorporate this tool into the regular workload … . I just couldn't think of anything in my daily workload where this tool would be useful.

  4. Great vid, thanks for the info.
    (Thanks for the puns for us oldsters at the opening, btw.)
    As far as sharing the channel, I did just that earlier today with someone self-proclaiming himself a linux noob and looking for more info.
    Keep up the great work.

  5. HEALTH – Caffeine
    Caffeine Blues by Stephen Cherniske – Unbekoming Book Summary
    Unbekoming
    Jun 15, 2024
    Caffeine Blues: Wake Up to the Hidden Dangers of America's #1 Drug
    45 Questions and Answers
    Kman, editor, DIGILEAK WORLD Newsletter and DIGILEAK NEWS (Bitchute)

  6. Yes but……. How do you "tee" the stderr stream? For example, I want to see all the output, but also send the results and errors to two files:

    find / -name '*.log' | tee find-results.txt | tee-errors find-errors.txt

    In this case "tee-errors" is the missing link

    Thanks in advance

  7. No kidding, I was just searching to learn the tee command on the browser and the next thought was to search search "tee command learn linux tv" and i see that the video is uploaded just now. Isn't this a next level co incidence.

Leave a Reply

Your email address will not be published. Required fields are marked *

Back to top button