Text Processing
rev
Reverse the characters in each line of input.
Synopsis
syntax
rev [FILE]...
Examples
Output: olleh
echo 'hello' | rev
Reverse each line of a file
rev file.txt
Test palindrome: racecar
echo 'racecar' | rev
About rev
The `rev` command reverse the characters in each line of input. Text processing commands transform, format, and generate text output.
Linux's philosophy of small composable tools shines here — these commands are designed to be piped together to build complex text-processing workflows. They are indispensable for scripting, log analysis, and data transformation tasks.
The command accepts 0 commonly used flags shown above, though the full set of options is available in the man page (`man rev`). The 3 examples on this page cover typical real-world usage patterns that you can copy and adapt for your own workflows.
Related commands
More Text Processing Commands
Other commands in the Text Processing category