LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
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!

Notices


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

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


Hi,

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

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

Rep: Reputation: 357Reputation: 357Reputation: 357Reputation: 357
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
shivaa
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:
Code:
~$ <command> >>/path/to/output
~$ cat /path/to/output
OR,
Code:
~$ <command> 2>/dev/null 1>>/path/to/output
~$ cat /path/to/output
For more details, check here.
 
  


Reply



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

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

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

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