--- layout: page author: Alessandro Luini category-page: advanced category-title: Advanced commands tags: translate title: tr ---

The tr command in Unix-like operating systems, which name stands for TRanslate or TRansliterate, indicating its operation of replacing or removing specific characters in its input data set.

How to use

The utility reads a byte stream from its standard input and writes the result to the standard output. As arguments, it takes two sets of characters (generally of the same length), and replaces occurrences of the characters in the first set with the corresponding elements from the second set.
For example,
tr 'abcd' 'jkmn'
would maps all characters a to j, b to k, c to m, and d to n.
The character set may be abbreviated by using character ranges. The previous example could be also written as:
tr 'a-d' 'jkmn'

Flags