Skip to content

Instantly share code, notes, and snippets.

@CalebBarnes
Created January 23, 2024 00:35
Show Gist options
  • Save CalebBarnes/b1993f40ae0280e43bd3969734ec469a to your computer and use it in GitHub Desktop.
Save CalebBarnes/b1993f40ae0280e43bd3969734ec469a to your computer and use it in GitHub Desktop.
Zsh ~ watch log files with bat + tail
# you can add this to your .zshrc, .zprofile, or source your own file like source ~/custom-commands.zsh
# Uses `bat` to display the files contents and watches for changes with `tail -f`
# very useful for watching log files
watch() {
if [ -z "$1" ]; then
echo "Usage: watch <filename>"
return 1
fi
tail -f "$1" | bat --paging=never -l log
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment