LinuxQuestions.org
Help answer threads with 0 replies.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices


Reply
  Search this Thread
Old 09-26-2016, 02:11 AM   #1
bremenpl
LQ Newbie
 
Registered: Apr 2013
Posts: 21

Rep: Reputation: Disabled
Observe a file


Hello there,
Is there an easy way in linux to observe a text file, and print in console the new content each time the file is appended? I would appreciate all help.
 
Old 09-26-2016, 03:25 AM   #2
allend
LQ 5k Club
 
Registered: Oct 2003
Location: Melbourne
Distribution: Slackware64-15.0
Posts: 6,357

Rep: Reputation: 2739Reputation: 2739Reputation: 2739Reputation: 2739Reputation: 2739Reputation: 2739Reputation: 2739Reputation: 2739Reputation: 2739Reputation: 2739Reputation: 2739
I would look at using 'inotifywait'. Search for a guide that suits you.
 
Old 09-26-2016, 03:38 AM   #3
pan64
LQ Addict
 
Registered: Mar 2012
Location: Hungary
Distribution: debian/ubuntu/suse ...
Posts: 21,684

Rep: Reputation: 7274Reputation: 7274Reputation: 7274Reputation: 7274Reputation: 7274Reputation: 7274Reputation: 7274Reputation: 7274Reputation: 7274Reputation: 7274Reputation: 7274
probably you can try the command tail.
 
1 members found this post helpful.
Old 09-26-2016, 05:24 AM   #4
goumba
Senior Member
 
Registered: Dec 2009
Location: New Jersey, USA
Distribution: Fedora, OpenSUSE, FreeBSD, OpenBSD, macOS (hack). Past: Debian, Arch, RedHat (pre-RHEL).
Posts: 1,335
Blog Entries: 7

Rep: Reputation: 402Reputation: 402Reputation: 402Reputation: 402Reputation: 402
tail is what you want:
Code:
tail -f filename
or

Code:
tail -F filename
from the man page:

Code:
       -f, --follow[={name|descriptor}]
              output appended data as the file grows;
              an absent option argument means 'descriptor'

       -F     same as --follow=name --retry
       --retry
              keep trying to open a file if it is inaccessible
 
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
[SOLVED] Script to run fstrim and observe output Johng Programming 6 10-04-2015 09:25 AM
Implementing Observer pattern when observers wish to observe different items Aquarius_Girl Programming 2 05-02-2012 09:27 AM
[SOLVED] redirecting output, observe with tail -f <file>, while running, without screen? srons Linux - Newbie 3 04-22-2010 06:43 AM
netlink routing socket to observe interface changes trotters78 Programming 2 11-29-2004 06:13 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Software

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