sharkdp / bat

A cat(1) clone with wings.
Apache License 2.0
49.36k stars 1.25k forks source link

Is there a way to run bat with -f (similar to tail -f) to follow a file ? #3065

Open mxaddict opened 2 months ago

mxaddict commented 2 months ago

Is there a way to run bat with -f (similar to tail -f) to follow a file ?

Alessandro201 commented 2 months ago

As far as I'm aware it does not have an option to do it itself, however you can combine it with tail -f. From the README:

bat can be combined with tail -f to continuously monitor a given file with syntax highlighting.

tail -f /var/log/pacman.log | bat --paging=never -l log

Note that we have to switch off paging in order for this to work. We have also specified the syntax explicitly (-l log), as it can not be auto-detected in this case.