• Skip to primary navigation
  • Skip to main content
  • Skip to primary sidebar
  • Skip to footer navigation

The Geek Diary

  • OS
    • Linux
    • CentOS/RHEL
    • Solaris
    • Oracle Linux
    • VCS
  • Interview Questions
  • Database
    • oracle
    • oracle 12c
    • ASM
    • mysql
    • MariaDB
  • DevOps
    • Docker
    • Shell Scripting
  • Big Data
    • Hadoop
    • Cloudera
    • Hortonworks HDP

tee: command not found

by admin

The tee command reads the standard input, sends the output to the default output device (the CLI), and also copies the output to each specified file. This command enables you to verify the output of a command immediately as well as store that output in a file for later reference. Like xargs, tee typically accepts input from another command using the pipe operator.

When used with the -a option, tee appends the output to each output file instead of overwriting it.

Syntax

The general syntax of the tee command is:

# command [options] [arguments] | tee [options] {file names}

Let’s say you want to check the contents of a directory and also output those contents to a file to process later. You could issue separate commands to do this, or you can use the tee command like so:

# ls -l | tee listing.txt

If you encunter below error while running the tee command:

tee: command not found

you may try installing the below package as per your choice of distribution:

Distribution Command
OS X brew install coreutils
Debian apt-get install coreutils
Ubuntu apt-get install coreutils
Alpine apk add coreutils
Arch Linux pacman -S coreutils
Kali Linux apt-get install coreutils
CentOS yum install coreutils
Fedora dnf install coreutils
Raspbian apt-get install coreutils

tee Command Examples

1. Copy standard input to each file, and also to standard output:

# echo "example" | tee path/to/file

2. Append to the given files, do not overwrite:

# echo "example" | tee -a path/to/file

3. Print standard input to the terminal, and also pipe it into another program for further processing:

# echo "example" | tee /dev/tty | xargs printf "[%s]"

4. Create a directory called “example”, count the number of characters in “example” and write “example” to the terminal:

# echo "example" | tee >(xargs mkdir) >(wc -c)

Filed Under: Linux

Some more articles you might also be interested in …

  1. acountry Command Examples in Linux
  2. The System Continuously Displayed the Error Message from the “avahi-demon” in /var/log/messages
  3. Interview Questions : Linux Package Manager (RPM)
  4. mpg123 Command Examples in Linux
  5. After Reboot RAID1 Disk Gets Removed/Out of Sync (CentOS/RHEL)
  6. Configuring sudo to Enable Commands for Non-Root Users in Linux
  7. chmod: command not found
  8. pacdiff Command Examples in Linux
  9. CentOS / RHEL : How to mount filesystems using UUID
  10. mandb Command Examples in Linux

You May Also Like

Primary Sidebar

Recent Posts

  • “aws s3 mv” Command Examples
  • “aws s3 mb” Command Examples
  • “aws s3 ls” Command Examples
  • “aws s3 cp” Command Examples

© 2023 · The Geek Diary

  • Archives
  • Contact Us
  • Copyright