Search code examples
linuxloggingtail

tail -f <filename>, print line number as well


Is there a way to modify so that the tail -f lists the line number of the current file as well.

Something similar to grep -n <Strings> *.


Solution

  • This command takes into account the number of lines above also

    tail -f -n +1 yourfile.txt | nl