5 ms·
The main purpose of `cat` is not to print a single file to stdout but to conCATenate files to stdout [0]. Of course if I have a single file it's printed alone.
by basemi 2y ago
The main purpose of `cat` is not to print a single file to stdout but to conCATenate files to stdout [0].
Of course if I have a single file it's printed alone.
Just here to say that `cat` is not a synonym of `print`, but nowadays it's "cat FILE" everywhere. Even in APIs... [1] (Compact and aligned text? XD)
[0] https://www.man7.org/linux/man-pages/man1/cat.1.html https://www.man7.org/linux/man-pages/man1/cat.1.html
[1] https://www.elastic.co/guide/en/elasticsearch/reference/current/cat.html https://www.elastic.co/guide/en/elasticsearch/reference/curr...
- saagarjha 2y agoYes and what I want to do is concatenate 1 file to stdout
- oneeyedpigeon 2y agoAnd you don't want to use a pager because you know the file is shorter than one screen?
- saagarjha 2y agoI have infinite scrollback and ⌘F
- scbrg 2y agopagers are sometimes more of a burden than a help. If a file is relatively short, the terminal's scrollback may be sufficient to navigate the content. A pager may not cooperate well with the terminal's UI for scrolling, and may even mess up scrollback history. And, depending on configuration, may clear the screen when it's closed against the user's wishes. Yes, there may be flags you can throw on them to make them behave the way you want, but those flags need to be remembered. `cat` is certainly shorter to type and easier to remember than `less -X`
- oneeyedpigeon 2y agoWhat about syntax highlighting? If you're only interested in viewing the file anyway, there's a decent chance that would improve your experience. I do accept that `cat file` is not a problem, but it's interesting to discuss alternatives anyway!
- Ferret7446 2y agoTry using a pager like more, which works on dumb terminals.