LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Software (https://www.linuxquestions.org/questions/linux-software-2/)
-   -   Observe a file (https://www.linuxquestions.org/questions/linux-software-2/observe-a-file-4175590152/)

bremenpl 09-26-2016 03:11 AM

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.

allend 09-26-2016 04:25 AM

I would look at using 'inotifywait'. Search for a guide that suits you.

pan64 09-26-2016 04:38 AM

probably you can try the command tail.

goumba 09-26-2016 06:24 AM

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



All times are GMT -5. The time now is 06:38 AM.