Alg_D
Alg_D

Reputation: 2390

linux - output changes on terminal when file changes

In a open terminal how could I see all the new content added to a file whenever a process writes data into it?

I've tried combinations with cat and tee but no success

Upvotes: 1

Views: 724

Answers (2)

sinkmanu
sinkmanu

Reputation: 1102

You can not do it with cat, you should use tail -f <filename> or less <filename> and push F in order to wait data.

$ man less
   ...
   F      Scroll  forward, and keep trying to read when the end of file is reached.  Normally this
          command would be used when already at the end of the file.  It is a way to  monitor  the
          tail  of  a file which is growing while it is being viewed.  (The behavior is similar to
          the "tail -f" command.)
   ...

Upvotes: 1

Raman Sailopal
Raman Sailopal

Reputation: 12867

Use tail with -f

tail -f filename

Taken from the man pages for tail:

   -f, --follow[={name|descriptor}]
          output appended data as the file grows;

          an absent option argument means 'descriptor'

Upvotes: 3

Related Questions