7 ms·
"bat" is not a better version of cat, it's a completely different tool. cat is short for concatenate. If you want to view a file use less, and if you want synta
by another-cuppa 8y ago
"bat" is not a better version of cat, it's a completely different tool. cat is short for concatenate. If you want to view a file use less, and if you want syntax highlighting etc. then use view (comes with vim).
- dguo 8y agobat can still be used to concatenate files: https://github.com/sharkdp/bat#file-concatenation https://github.com/sharkdp/bat#file-concatenation "Whenever bat detects a non-interactive terminal, it will fall back to printing the plain file contents."
- geoalchimista 8y ago> if you want syntax highlighting etc. then use view I'd like to recommend pygmentize also for syntax highlighting. Works like cat and supports a lot of languages. But since pygmentize is written in Python, it may not run as fast as bat. (I haven't tried bat though, because pygmentize is fast enough for my daily use cases.)
- jolmg 8y agoMost tools mentioned are completely different tools from the ones they're suggested to be better versions of. I understand the comparison is for specific use-cases. For example, csvkit is far better than trying and failing to parse CSV with awk, but it's very much useless for any other type of text format. Same thing with jq (a JSON query tool) vs grep (a general text search tool). The only ones I can agree with in the general case are htop > top and ag || ack > grep (though I still prefer grep sometimes).
- burntsushi 8y agoIf you don't mind me asking, in roughly what cases do you reach for grep instead of ag || ack? Is it a familiarity thing, or specific features or something else?
- earenndil 8y agoNot the gp, but I generally use ripgrep when I want to find something manually, and regular grep in a script.
- burntsushi 8y agoAh yeah, me too! That's a good one.
- vram22 8y agoWhy? Does ripgrep not work as well (or better) than grep in a script? And if so, why not? Or is because you deploy your scripts to other machines where ripgrep may not be present, but grep will?
- jolmg 8y agoScripts tend to be shared, so portability matters. grep alternatives, while great for interactive use, are generally not worth being an extra dependency to install.
- earenndil 8y agoGrep is: * Deterministic * Standard * Written in c * Equally performant (where it matters) * Doesn't show colour or line numbers unless I tell it to * Doesn't watch .gitignores unless I tell it to
- executesorder66 8y agoI use rg on all my scripts that I won't be sharing with others. Anything that needs to be used by other people / needs to be run on any machine that I don't control, uses grep instead.
- smartmic 8y agowhether cats or bats … beware of the Useless use of cat (UUOC) (or bat) ;)
- h1d 8y agoI'm starting to use vimpager after realizing I don't feel good seeing 2 different coloring on the terminal and in vim, instead, this way, whatever your vim supports (color, utility, key binding) can be carried over as a pager. The project is still rough around the edges but mostly good. https://github.com/rkitover/vimpager https://github.com/rkitover/vimpager