tags:

views:

837

answers:

3

In bash, calling foo would display any output from that command on the stdout.

Calling foo > output would redirect any output from that command to the file specified (in this case 'output').

Is there a way to redirect output to a file and have it display on stdout?

+17  A: 

The command you want is named tee

ls -lR / | tee output.file

Zoredache
Alabaster Codify
+1  A: 

'tail -f output' should work.

Chuck Phillips
A: 

tee is perfect for this, but this will also do the job

ls -lr / > output | cat output

kal
That's an error if output doesn't already exist and it doesn't do what you want if it does, overall it is nonsensical. Perhaps you meant ";" instead of "|" ?
Robert Gamble