Reverse Text With rev
Reverse the characters of every input line with a small built-in filter.
Run echo "cmdcv" | rev to print the characters backwards.
01Command
Command
$ echo "cmdcv" | rev02What it does
rev reads lines and outputs each one with its characters reversed, a surprisingly handy way to check palindromes or to process fixed-width fields from the end. It is included by default on macOS and available in util-linux on Linux.
03Risk
!Warning: It reverses bytes, not grapheme clusters, so multi-byte emoji can be mangled.
04Undo
✓No undo needed — this command does not change persistent state.
05Sources
- rev(1) — FreeBSD manualEvidence: Reverses the order of characters in each line; the basis of the macOS rev.
Last verified: 2026-09-20 · Category: Developer
06Related solutions
Change where screenshots are saved on Mac
Point macOS screen captures at any folder you choose instead of the desktop.
Download a file from a URL on Mac with curl
Grab any file from the web straight into the current folder — no browser needed.
Find files larger than 500 MB on Mac
List the biggest files in your home folder that are eating disk space.