4 ms·
My favourite seemingly-useless-but-actually-not-useless use of cat:- ls | cat
by alexkus 13y ago
My favourite seemingly-useless-but-actually-not-useless use of cat:-
ls | cat
- sophacles 13y agoWhy is it not actually useless?
- ben0x539 13y agoIt makes the output for ls not a terminal, so ls won't try to present the output in a nice human-readable format, with columns and colors etc. Of course there's switches for all that in ls somewhere, but still...
- pdw 13y agoOr just ls -1 (that's a digit one)
- alexkus 13y agoAh, but with the --color=auto option on ls (which I have set in my aliases) there's a difference between "ls -1" and "ls | cat" Indeed there's even a difference between "ls -1" and "ls -1 | cat" if "--color=auto" is specified.
- kpreid 13y agoI use this for programs which otherwise output to pagers, when I'd rather have the output just in terminal scrollback. (And unlike the -1 option it's generic to all programs with terminal behaviors.)