• Home
  • Archive
  • Tools
  • Contact Us

The Customize Windows

Technology Journal

  • Cloud Computing
  • Computer
  • Digital Photography
  • Windows 7
  • Archive
  • Cloud Computing
  • Virtualization
  • Computer and Internet
  • Digital Photography
  • Android
  • Sysadmin
  • Electronics
  • Big Data
  • Virtualization
  • Downloads
  • Web Development
  • Apple
  • Android
Advertisement
You are here:Home » Using the tee Command and Difference With cat Command

By Abhishek Ghosh April 29, 2023 8:07 am Updated on April 29, 2023

Using the tee Command and Difference With cat Command

Advertisement

The tee command converts a standard output into a standard input and also can write this to files. So tee is practically only about writing to a file. The cat command is for reading (both input and files) and writing (with > and >>) to files. cat is a powerful and safe tool. tee is used in specific advanced complex cases. For the below function, you can not use cat:

Vim
1
2
3
4
// 23.227.167.33 is our one server's IP at the time of writing this guide
#
ping 23.227.167.33 | tee [-a] ping_report.txt
#

cat is even safer than Echo. The echo command can erase a file:

Vim
1
2
3
#
echo " " > /etc/mysql/mariadb.cnf
#

If improperly executed, the tee can do a similar thing. So, tee and echo should be carefully used. The file into which Tee saves the read data can be newly created when necessary. The reason for using the tee is to preserve intermediate results within a Linux pipe.

Advertisement

---

Do not use a tee on a production server for learning purposes. Instead, learn to use tee on a local computer and then use it on a production server.

 

How is the tee Command Used?

 

The basic format of the tee command looks like this:

Vim
1
tee [OPTIONS] [FILE]

Here is an example for the use:

Vim
1
du -h | tee disk_usage.txt

If you want to add the new content, add the -a flag and the command would look like this:

Vim
1
du -h | tee -a disk_usage.txt

Using the tee Command and Difference With cat Command

To understand the function, run:

Vim
1
date | tee time.txt

If you run the command for a second time, it will get overwritten. If you add a -a flag, it will append a new line:

Vim
1
date | tee -a time.txt

We can echo and write:

Vim
1
echo "Visit https://thecustomizewindows.com" | sudo tee -a test_document.txt

The tee command simply creates an N+1 number of lines or files.

Facebook Twitter Pinterest

Abhishek Ghosh

About Abhishek Ghosh

Abhishek Ghosh is a Businessman, Surgeon, Author and Blogger. You can keep touch with him on Twitter - @AbhishekCTRL.

Here’s what we’ve got for you which might like :

Articles Related to Using the tee Command and Difference With cat Command

  • Nginx WordPress Installation Guide (All Steps)

    This is a Full Nginx WordPress Installation Guide With All the Steps, Including Some Optimization and Setup Which is Compatible With WordPress DOT ORG Example Settings For Nginx.

  • Command Prompt Commands : Alphabetical list of all commands in Windows 7

    Command Prompt Commands in Windows 7 provides the user access to 180+ command line commands. Here is a list of 200 Command Prompt Commands in Windows 7.

  • WordPress & PHP : Different AdSense Units on Mobile Devices

    Here is How To Serve Different AdSense Units on Mobile Devices on WordPress With PHP. WordPress Has Function Which Can Be Used In Free Way.

  • Changing Data With cURL for OpenStack Swift (HP Cloud CDN)

    Changing Data With cURL For Object is Quite Easy in OpenStack Swift. Here Are Examples With HP Cloud CDN To Make it Clear. Official Examples Are Bad.

performing a search on this website can help you. Also, we have YouTube Videos.

Take The Conversation Further ...

We'd love to know your thoughts on this article.
Meet the Author over on Twitter to join the conversation right now!

If you want to Advertise on our Article or want a Sponsored Article, you are invited to Contact us.

Contact Us

Subscribe To Our Free Newsletter

Get new posts by email:

Please Confirm the Subscription When Approval Email Will Arrive in Your Email Inbox as Second Step.

Search this website…

 

Popular Articles

Our Homepage is best place to find popular articles!

Here Are Some Good to Read Articles :

  • Cloud Computing Service Models
  • What is Cloud Computing?
  • Cloud Computing and Social Networks in Mobile Space
  • ARM Processor Architecture
  • What Camera Mode to Choose
  • Indispensable MySQL queries for custom fields in WordPress
  • Windows 7 Speech Recognition Scripting Related Tutorials

Social Networks

  • Pinterest (24.3K Followers)
  • Twitter (5.8k Followers)
  • Facebook (5.7k Followers)
  • LinkedIn (3.7k Followers)
  • YouTube (1.3k Followers)
  • GitHub (Repository)
  • GitHub (Gists)
Looking to publish sponsored article on our website?

Contact us

Recent Posts

  • What is Hardware Security Module (HSM)September 30, 2023
  • Transducer Technologies of HeadphonesSeptember 28, 2023
  • What is Analog-to-Digital Converter (ADC)September 27, 2023
  • Comparison of Tube Amplifiers and SemiconductorsSeptember 26, 2023
  • What is a Digital-to-Analog Converter (DAC)September 25, 2023
PC users can consult Corrine Chorney for Security.

Want to know more about us?

Read Notability and Mentions & Our Setup.

Copyright © 2023 - The Customize Windows | dESIGNed by The Customize Windows

Copyright  · Privacy Policy  · Advertising Policy  · Terms of Service  · Refund Policy