REV(1) General Commands Manual REV(1)

revreverse lines of a file

rev [file ...]

The rev utility copies the specified files to the standard output, reversing the order of characters in every line. If no files are specified, the standard input is read.

Reverse the text from stdin:

$ echo -e "reverse \t these\ntwo lines" | rev
eseht    esrever
senil owt
June 27, 2020 macOS 15.2