Created
January 23, 2024 00:35
-
-
Save CalebBarnes/b1993f40ae0280e43bd3969734ec469a to your computer and use it in GitHub Desktop.
Zsh ~ watch log files with bat + tail
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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