tee command


Tee is a very useful command when using with pipe. If you use, ls -l > file.txt, you will get same file.txt which contains all lists of files, directories, and information for those, but you will not see the result on the screen. However, tee command makes files with output, and it also passes the output to next command.

less command on the picture is used to display information to the terminal one page at a time. less is faster than other command because it doesn’t need to read entire file before starting.

Let’s say that you are about to put some debugging results in text file for huge program or multiple programs. Are you going to just sit there doing nothing until debugging and writing process done or watch which errors occur while the process is running?

  • This command makes file and also does word counting of the output.

$ ls -l | tee result.txt | wc


  • This command makes file and also prints out the output, because there is no command after.

$ ls -l | tee result.txt

Leave A Comment

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