Redirecting output to a file and stdout

0 votes

Calling foo in bash would display any output from that command on the stdout.

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

May 31 in Linux Administration by Upasana
• 8,530 points
30 views

1 answer to this question.

0 votes

The command you want is named tee;

foo | tee output.file
answered May 31 by Shubham
• 13,300 points

Related Questions In Linux Administration

0 votes
1 answer

How to collect all output in one file?

You can use 2> to redirect it: foo ...READ MORE

answered Mar 1 in Linux Administration by ajs3033
• 7,280 points
31 views
0 votes
1 answer

How to install a deb file?

You can install a .deb file with ...READ MORE

answered Apr 1 in Linux Administration by Shaan
23 views
0 votes
1 answer

To attach a file using mail command on Linux

$ echo | mutt -a syslogs.tar.gz admin@domain.org READ MORE

answered Jun 28 in Linux Administration by Upasana
• 8,530 points
120 views
0 votes
1 answer
0 votes
1 answer
0 votes
1 answer

how to loop through the content of a file using bash

One of the ways to do it ...READ MORE

answered Feb 15 in Linux Administration by ajs3033
• 7,280 points
81 views
0 votes
1 answer

redirecting stdout and stderr to file using bash

cmd >>file.txt 2>&1 Bash always executes and redirects ...READ MORE

answered Mar 19 in Linux Administration by ajs3033
• 7,280 points
49 views
0 votes
1 answer
0 votes
1 answer

Writing a heredoc to a file in a script

try to use tee: tee newfile <<EOF line 1 line 2 line ...READ MORE

answered May 20 in Linux Administration by Shubham
• 13,300 points
50 views
0 votes
1 answer