Languages
[Edit]
EN

Bash - how to follow log file changes?

10 points
Created by:
Marcin
2477

There are few solutions:
1. tail + watch commands:

$ watch -n 1 tail -n 10 path/to/log/file

Note: to end watching press ctrl^c (ctrl+c)

Where:

  • -n 1 causes refreshing once per second
  • -n 10 causes reading 10 last lines from file

2. less command

$ less +F path/to/file

Note: to end watching press ctrl^c (ctrl+c); to exit less program press q key.

It is possible to enable following for opened less program by pressing shift+f keys.

Hey 👋
Would you like to know what we do?
  • Dirask is a friendly IT community for learners, professionals and hobbyists to share their knowledge and help each other in extraordinary easy way.
  • We welcome everyone,
    no matter what the experience,
    no matter how basic the question is,
    this community will help you.