Rev

From LQWiki
Jump to navigation Jump to search

rev is the same as cat, only rev shows characters in reverse. Imagine a file foo that contains:

hello
world

rev foo will print:

olleh
dlrow

to print lines in reverse you can use tac, to print both lines and characters in reverse, for example, use:

tac foo | rev


Provided by

Most (all?) Linux distributions incorporate this from the [util-linux] project.

Related Commands

These all relate to the output or processing of entire files

  • cat -- concatenate files into a single result.
  • tac -- line-reversed cat
  • nl -- output with line numbers
  • od -- dump in octal and other character representations.
  • base32 -- Encode in printable characters.
  • base64 -- Encode in printable characters.