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

preview_player
Показать описание
The Linux Crash Course series on Learn Linux TV will teach you an important Linux-related skill or concept in each video. In this episode, Jay will cover the tee command, which lets you see and save output at the same time!

*LEARN LINUX TV - YOUR HOME FOR LINUX-RELATED FUN AND LEARNING!*

*🎓 BRAND NEW UDEMY COURSES AVAILABLE!*
Check out my new courses on Udemy and learn something new!

*🐧 SUPPORT LINUX LEARNING!*
_Note: Royalties and/or commission is earned from each of the above links_

*🎓 FULL LINUX COURSES FROM LEARN LINUX TV*

*🕚 Time Codes*
00:00 - Intro
01:37 - Quick refresh
03:13 - Basic usage of the tee command
05:01 - Using tee with reports and lists
07:03 - Writing output to multiple files
08:15 - Permissions matter with tee
09:29 - Using append mode with the tee command

*📘 FAQ*

*🌐 LEARN LINUX TV ON THE WEB*

*⚠️ DISCLAIMER*
Learn Linux TV provides technical content that will hopefully be helpful to you and teach you something new. However, this content is provided without any warranty (expressed or implied). Learn Linux TV is not responsible for any damages that may arise from any use of this content. Always make sure you have written permission before working with any infrastructure and that you are compliant with all company rules, change control procedures, and local laws.

#CloudComputing #DevOps #Linux
Рекомендации по теме
Комментарии
Автор

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.

pravinkumarone
Автор

0:38 I was not ready for the Mr. T reference HAHAHA

juanmacias
Автор

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.

marioawad
Автор

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.

QHPRN
Автор

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.

stevefiorito
Автор

@Jay

Yeah, caught the A-team lines but then remembered his real name is 'Mr. T' too! :) Well, not his 'real name' just not his A Team show name'

cleightthejw
Автор

At 5:16, that's true for Mint and Raspberry Pi At 6:55, you will get a warning from apt, it's not crazy about the tee command !

tubeDude
Автор

Oh, I see. So the redirection command (ls > file1.txt) does the same thing, but tee allows you to pipe output to multiple files at once?

ringo
Автор

How can i use the packages.log to get all package names and paste them into a command somewhere else?

TheCârtiță
Автор

Where's the "sudo nala install --install-suggests coffee" t-shirt?

josephglover
Автор

Yes 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

jeremiahbullfrog
Автор

Sorry to say this, but you kinda missed the point of tee. Its general use comes from commands like ls -R | tee file | grep n Hence the name.

aermacchi