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,410 points
18 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,110 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,240 points
19 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
17 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,410 points
21 views
0 votes
1 answer

How to display a simple list of all disks, like this /dev/sda /dev/sdb ?

You can list all the disk in ...READ MORE

answered Jul 12, 2018 in Linux Administration by DearestOne
• 200 points
95 views
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,240 points
59 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,240 points
25 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,110 points
21 views
0 votes
1 answer