maux
Star on GitHub Buy me a coffee

Manual / tr

tr(1)

TR(1) General Commands Manual TR(1)

tr - transliterate

tr [-cds] string1 [string2]

Tr copies the standard input to the standard output with substitution or deletion of selected characters. Input characters found in string1 are mapped into the corresponding characters of string2. A short string2 is extended by repeating its last character.

Complement string1 over all 256 byte values.
Delete input characters in string1 instead of translating.
Squeeze repeated output characters in string2 to one copy. If string2 is absent, use string1 as the squeeze set.

Only translation requires two strings; deletion or squeezing alone can use one. An ascending range such as a-z abbreviates successive characters. Unlike V6 tr, ranges are not bracketed. Quote the strings to protect them from the shell:

tr a-z A-Z <input >output

/usr/man/TR this page

sh(1), licenses(1)

Exit status is 0 on completion, 2 for usage errors.

No backslash escapes, character classes or repetition notation are implemented. Shell operands are high-bit maux text; they do not name the corresponding low-ASCII bytes. Input bytes are otherwise passed unchanged.

September 19, 2026 maux