# Redirecting command output to two files

**URL:** https://forum.highend3d.com/t/redirecting-command-output-to-two-files/68339
**Category:** Archived
**Tags:** linux-forum
**Created:** [February 23, 2004, 5:52am UTC](https://forum.highend3d.com/t/redirecting-command-output-to-two-files/68339 "2004-02-23T05:52:31Z")
**Posts on this page:** 3
**Page:** 1

<div class="post-metadata">

### Author: ![cire](https://forum.highend3d.com/letter_avatar_proxy/v4/letter/c/977dab/32.png) [@cire](https://forum.highend3d.com/u/cire)
#### Post date: [February 23, 2004, 5:52am UTC](https://forum.highend3d.com/t/redirecting-command-output-to-two-files/68339/1 "2004-02-23T05:52:31Z")

</div>

is it possible to redirect the output of a command, say cat, to two files simultaneously?

cire

---

<div class="post-metadata">

### Author: ![agentex](https://forum.highend3d.com/letter_avatar_proxy/v4/letter/a/ed655f/32.png) [@agentex](https://forum.highend3d.com/u/agentex)
#### Post date: [February 23, 2004, 8:10pm UTC](https://forum.highend3d.com/t/redirecting-command-output-to-two-files/68339/2 "2004-02-23T20:10:29Z")

</div>

You could cat and then cp.

ls -l | cat \> test && cp test test2

or if you need to append to both files.

ls -l | cat \>\> test ; ls -l cat \>\> test2

I’m don’t know of a way to append with cp and also I can’t get a line where i can double pipe the output. Not really into bash scripting currently but it is a nice skill to have.

---

<div class="post-metadata">

### Author: ![hation-hation](https://forum.highend3d.com/letter_avatar_proxy/v4/letter/h/4da419/32.png) [@hation-hation](https://forum.highend3d.com/u/hation-hation)
#### Post date: [February 25, 2004, 1:57pm UTC](https://forum.highend3d.com/t/redirecting-command-output-to-two-files/68339/3 "2004-02-25T13:57:46Z")

</div>

You could use tee. Example:

cat src\_file | tee dst\_file1 \> dst\_file2
