LinuxQuestions.org
Visit Jeremy's Blog.
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 07-25-2010, 10:04 AM   #1
greatcz
LQ Newbie
 
Registered: Jul 2010
Posts: 8

Rep: Reputation: 0
How to save the output to a log file without wiping the previous contents


Can someone tell me how to save the output to a log file without wiping the previous contents?
For example, I run a program called "luck" and it outputs a sentence like "good luck".
Then "./luck -> logfile" will save the output content to logfile.
But when I run another program called "hello" and it outputs a sentence like " Hello world".
Then "./hello-> logfile" will save the output content to logfile and wipe the previous contents.
Is is possible to keep both sentences in the logfile? Just like
good luck
Hello world
 
Old 07-25-2010, 10:09 AM   #2
imagine_me2
Member
 
Registered: Nov 2009
Location: Kolkata, India
Distribution: Fedora 11
Posts: 136

Rep: Reputation: 22
use ">>" instead of ">"
 
1 members found this post helpful.
Old 07-25-2010, 10:14 AM   #3
theNbomr
LQ 5k Club
 
Registered: Aug 2005
Distribution: OpenSuse, Fedora, Redhat, Debian
Posts: 5,399
Blog Entries: 2

Rep: Reputation: 908Reputation: 908Reputation: 908Reputation: 908Reputation: 908Reputation: 908Reputation: 908Reputation: 908
Quote:
Originally Posted by imagine_me2 View Post
use ">>" instead of ">"
And, to make it completely clear, the syntax does not include a dash ('-'). Your example, modified for appending, would look like:
Code:
./hello >> logfile
--- rod.
 
1 members found this post helpful.
  


Reply


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
Clean Up Log - Search for Pattern in Log file and Output result bridrod Linux - Newbie 10 01-05-2010 09:49 AM
howto get my usb storage device on the bootoader without wiping off the previous boot Fred Caro Linux - Newbie 6 03-17-2008 03:09 PM
How to graph contents of squid log file gmtonga Linux - Newbie 1 01-22-2008 06:01 AM
Output contents to file on server from konsole helptonewbie Linux - Networking 4 02-13-2007 05:00 PM
How to save the shell's contents to a file? Xiangbuilder Linux - Newbie 3 09-04-2003 07:47 PM

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

All times are GMT -5. The time now is 09:32 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