rev command

Shows text in reverse order, by text string or line by line

Typical usage: shell scripting, system administration

Introduction into rev

The rev command can be used to read data and show the reversed version. When using it with files, it will reverse the output line by line. This tool is helpful with shell scripting when some data needs to be reversed.

Installation

When rev is not installed by default, it can be added to the system using the relevant software package.

Package information for rev

Operating systemPackage nameInstallation
AlmaLinuxutil-linux-core
dnf install util-linux-core
Arch Linuxutil-linux
pacman -S util-linux
Debianutil-linux
apt install util-linux
Fedorautil-linux-core
dnf install util-linux-core
Red Hat Enterprise Linuxutil-linux-core
dnf install util-linux-core
Rocky Linuxutil-linux-core
dnf install util-linux-core
openSUSEutil-linux
zypper install util-linux
Ubuntuutil-linux
apt install util-linux

Your Linux distribution using a different package? Share your feedback.

Usage

Examples using rev

Read from standard input and reverse the string 1234

echo 1234 | rev

Output: 4321

Frequently Asked Questions

What is the rev command and its purpose?

The rev command is a command-line tool on Linux to reverse text or data from a file.

Which package provides the rev command?

The command rev is provided by the util-linux or util-linux-core package.

Related and similar commands

Linux has a lot of tools and commands available and sometimes you just need that little other tool. Here is a list of commands that are similar or related to rev:

Related and similar commands to rev
CommandCategorySummary
awkdata processingPerforms data extraction and reporting from files
basenamefilesStrips directory and file name suffix from a given path
headdata processingShow the first number of lines from a file
niceprocessesRuns commands with specified priority