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 12-29-2005, 02:15 PM   #1
Registered: Dec 2004
Location: WV, USA
Distribution: Gentoo, Debian
Posts: 186

Rep: Reputation: 34
How to keep reading a file (quick question)

I know there's a way because I've done it before in log files and sent the output here for debuging

If a file keeps getting additions to it (append?) how do you read the additiosn to the file? Like say you have program > file to log what it does but you also want to see what it's doing.

Another question: When you use > or >> it sends everything but errors / warnings. How do you send even the errors to the file?

What I'm wanting to do is log my bzfs server but I also want to see normal output from it. bzfs ..... > logfile. grep | cat-nsf logfile...

Last edited by 1veedo; 12-29-2005 at 02:17 PM.
Old 12-29-2005, 02:35 PM   #2
LQ Newbie
Registered: Oct 2004
Location: Austin TX
Distribution: Debian
Posts: 17

Rep: Reputation: 0
Let me tell you about a command called 'tail'. Let's say you want to continuously view the output of /var/log/syslog (somthing I do a LOT):

tail -f /var/log/syslog

and kill it with CTRL-C. That's all there is to that.

2nd question:
What you're seeing here is the separation between STDOUT & STDERR (the standard output & standard error streams). Here's the portable (shell agnostic) way of grabbing them both:

command > file_to_write.log 2>&1

and here's the Bash-specific way (which I prefer):

command &> file_to_write.log
Old 12-29-2005, 03:56 PM   #3
Registered: Dec 2004
Location: WV, USA
Distribution: Gentoo, Debian
Posts: 186

Original Poster
Rep: Reputation: 34
Cool, thanks.


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
Quick Question: Which driver file to use for Dell TrueMobile 1350 Wireless card? robert2513 Linux - Wireless Networking 3 12-24-2005 02:34 PM
quick File Manager question wrybread Linux - Newbie 1 12-04-2005 02:07 AM
awk: fatal:cannot open file for reading (no such file or Directory) in Linux sangati vishwanath Linux - Software 4 07-06-2005 12:59 AM
c program reading file question blackzone Programming 1 11-19-2004 03:50 AM
Script, Reading a file, When end of file? elibm Programming 2 07-16-2001 11:01 AM > Forums > Linux Forums > Linux - Newbie

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