Home > Mobile >  I want to watch a log file
I want to watch a log file

Time:09-15

I am running stuff on a server, and I find watch -n 30 qstat job.pbs a bit uninformative. Why can't I get

$ watch -n 30 less location/of/log|tail

to work? I get a blinking cursor. I do get output from

less location/of/log|tail

CodePudding user response:

Try tail -f log.txt The -f option is designed to do exactly that: Every time the file is updated, it displays the addition.

CodePudding user response:

I find less is more convenient if you want more than just following a log file (e.g., scrolling and searching etc.). E.g. open log file with less as follows:

less /path/to/log

then press

Shift F - to follow the log (behaves just like tail -f)

Ctrl C - to stop following the log

?pattern - to search backward in log file

  • Related