Review your favorite Linux distribution.
Go Back > Forums > Linux Forums > Linux - Newbie
User Name
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!


  Search this Thread
Old 03-28-2013, 07:33 PM   #1
Registered: Oct 2011
Posts: 85
Blog Entries: 1

Rep: Reputation: Disabled
I/O Redirection - Send STDOUT to file and also display


How do I append STDOUT to a logfile and display it also?

Old 03-28-2013, 07:56 PM   #2
Senior Member
Registered: Nov 2004
Distribution: Debian, Ubuntu, LinuxMint, Slackware, SysrescueCD, Raspbian
Posts: 2,191

Rep: Reputation: 338Reputation: 338Reputation: 338Reputation: 338
cat file 2>&1 | tee output_file

2>&1 is optional ... only needed if you want to save stderr also

Obviously, "cat file" is just a contrived example - if the content is already in a file you obviously don't need to save it again into a different file.

Last edited by haertig; 03-28-2013 at 07:59 PM.
Old 03-28-2013, 10:56 PM   #3
Senior Member
Registered: Jul 2012
Location: Grenoble, Fr.
Distribution: Sun Solaris, RHEL, Ubuntu, Debian 6.0
Posts: 1,800
Blog Entries: 4

Rep: Reputation: 286Reputation: 286Reputation: 286
In order to 'append' stdout to a file you can either use:
~$ <command> >>/path/to/output
~$ cat /path/to/output
~$ <command> 2>/dev/null 1>>/path/to/output
~$ cat /path/to/output
For more details, check here.


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
STDOUT redirection problem in BASH qubuntu Linux - Newbie 6 04-05-2010 08:06 AM
Automatically stdout redirection to a file tikit Linux - Newbie 4 10-10-2008 05:18 AM
send stderr to a file and also to stdout pranavchoudhary Linux - Newbie 7 08-25-2008 01:57 AM
redirection the process stdout do1do Linux - Security 3 11-23-2003 11:39 PM
redirection process stdout do1do Linux - General 2 11-23-2003 09:06 PM > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 12:39 AM.

Main Menu
Write for LQ is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration