af40908294
git-svn-id: svn+ssh://atelier.inf.usi.ch/home/bevilj/group-1@254 a672b425-5310-4d7a-af5c-997e18724b81
46 lines
1.3 KiB
HTML
46 lines
1.3 KiB
HTML
---
|
|
layout: page
|
|
category-page: intermediate
|
|
category-title: Intermediate commands
|
|
tags: tee output save
|
|
author: Nicola Brunner
|
|
title: tee
|
|
previous-page: pages/cmd/interm/tar.html
|
|
next-page: pages/cmd/interm/watch.html
|
|
---
|
|
|
|
The <code>tee</code> command is used to split the output of a program, doing
|
|
this the output can be displayed in the shell and in the same time written in a
|
|
file. This is useful, for example, if we want to capture intermediate outputs of
|
|
a long program.
|
|
The command is named after the T-splitter used in plumbing, because they have
|
|
similar functions.<br>
|
|
|
|
<h3>Usage:</h3>
|
|
The default tee command syntax is:
|
|
|
|
<pre>
|
|
tee [flags] [file]
|
|
</pre>
|
|
|
|
Where <code>[flags]</code> are the tee flags (below you will find more info),
|
|
and argument <code>[file]</code> is a file or a list of files, each of which
|
|
receives the output.<br>
|
|
|
|
<h3>Flags:</h3>
|
|
|
|
<ul>
|
|
<li><code>-a</code> Appends the output to each file, rather than overwriting it.</li>
|
|
<li><code>-i</code> Ignores interrupt signals.</li>
|
|
</ul>
|
|
|
|
<h3>Example:</h3>
|
|
|
|
<pre>
|
|
date | tee example.txt
|
|
</pre>
|
|
|
|
With this example, we can see that tee writes the date in
|
|
<i>example.txt</i>, but shows also the output (in this case the date) in the shell.
|
|
If you would prefer to have content appended instead of overwritten on the file,
|
|
should use <code>-a</code> flag on <code>tee</code>.
|