3 ms·
tac is cat spelled backwards it prints the contents in reverse order.
by brian_herman__ 6y ago
tac is cat spelled backwards it prints the contents in reverse order.
- jooize 6y agoHow is input to a pipe reversed?
- umanwizard 6y agoBy saving all the input in memory (EDIT: or to a file, as another comment points out) until EOF, then writing the lines out in reverse order. It's not really possible to do in a stateless/streaming way.
- wolfgang42 6y agoIt’s written to a seekable tempfile first: https://github.com/coreutils/coreutils/blob/6a3d2883fed853ee01079477020091068074e12d/src/tac.c#L542-L556 https://github.com/coreutils/coreutils/blob/6a3d2883fed853ee...