tee Linux Commands

What is Linux tee Command?

Explanation

tee COMMAND:

tee command executes the given command and stores the standard output of that command in to one or more files.

SYNTAX :


tee [OPTION]... [FILE]..

OPTIONS:


-a, --append append to the given FILEs, do not overwrite.
-F<character> tells a2p that this awk script is always invoked with this -F switch.
-i, --ignore-interrupts ignore interrupt signals.
--help display this help and exit.

EXAMPLE:


  1. ls | tee listfile.txt
    Output:
    aa.txt admin.php Desktop dir1 Documents Downloads error_log fes file file_path.php help IE8-WindowsXP-x86-ENU.exe install.php log.txt Music mysqlsla-2.03 NetBeansProjects nohup.out opt Pictures question.png Templates tests.txt tes.txt tet.txt Text-2.txt
    In the above example, the tee cmd would list all files in the current directory and also writes the standard output into the file 'listfile.txt'.

Ask Questions

Ask Question