Welcome to the most active Linux Forum on the web.
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 07-01-2009, 04:57 AM   #1
Registered: Jan 2006
Location: Sydney
Distribution: RHEL
Posts: 72

Rep: Reputation: 15
Redirecting to Files and STDIN

tee command can be used to read from standard input and write to standard output and files. So, I can, for example, do the following:
(date; users; uptime;)| tee mylog.txt
How can I modify the code so that the output is appended to the file (not overwritten)?

Please notice that I want the output to both the STDOUT and the file.

Thanks in advance.
Old 07-01-2009, 05:01 AM   #2
Registered: Jan 2009
Posts: 165

Rep: Reputation: 44
tee has a "-a" command-line option to do what you want.
Read the manual page 'man tee' for more info.


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
redirecting stdin in bash script artur Programming 3 12-09-2011 07:07 AM
redirecting /dev/ttyS0 -> stdin goestin Linux - Software 2 10-26-2011 12:34 PM
piping and redirecting files shtek Linux - Newbie 4 01-15-2008 10:39 AM
after redirecting stdin still need to read data from keyboard vrikers Programming 4 10-31-2004 07:11 AM
redirecting stdin and stdout with pipes: convincing apps they're for a terminal? prell Programming 1 09-02-2004 07:38 AM > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 06:03 PM.

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