TR(1)

✨ TR(1) β€” bestie, it's the tr manual ✨

okay so picture this: you've got a manual page, right? it's called tr, it lives in the General Commands Manual section (section 1, the "commands you actually type" section πŸ’…), and it is literally here to translate or delete characters. iconic behaviour honestly.


🌸 NAME 🌸

tr β€” translate or delete characters πŸ¦‹

πŸ’– SYNOPSIS πŸ’–

tr [OPTION]... SET1 [SET2]

πŸŽ€ DESCRIPTION πŸŽ€

Translate or delete characters. that's the whole job description bestie, and she does it flawlessly ✨

πŸ‘‘ OPTIONS πŸ‘‘

  • -c, --complement β€” use the complement of SET1. like, the opposite set? yeah. the leftovers. the ones not in SET1 🫢
  • -d, --delete β€” delete characters in SET1, do not translate. so long, farewell πŸ™ˆ
  • -s, --squeeze-repeats β€” replace each sequence of a repeated character that is listed in the last specified SET, with a single occurrence of that character. yes bestie, squeezing the dupes together into one single slay πŸ’…
  • -t, --truncate-set1 β€” first truncate SET1 to length of SET2. cut her down to size βœ‚οΈ
  • -h, --help β€” Print help. we love a helpful queen 🌈
  • -V, --version β€” Print version. receipts, periodt ⭐
  • [sets]

πŸ¦‹ EXTRA πŸ¦‹

Translate, squeeze, and/or delete characters from standard input, writing to standard output. she reads from stdin, she writes to stdout, she does not play about it 😭πŸ”₯

πŸ’œ VERSION πŸ’œ

v(uutils coreutils) 0.12.0 β€” no cap 🫢

🌈 EXAMPLES 🌈

Replace all occurrences of a character in a file, and print the result:

tr < path/to/file find_character replace_character

Replace all occurrences of a character from another command's output:

echo text | tr find_character replace_character

Map each character of the first set to the corresponding character of the second set:

tr < path/to/file 'abcd' 'jkmn'

Delete all occurrences of the specified set of characters from the input:

tr < path/to/file [-d|--delete] 'input_characters'

Compress a series of identical characters to a single character:

tr < path/to/file [-s|--squeeze-repeats] 'input_characters'

Translate the contents of a file to upper-case:

tr < path/to/file "[:lower:]" "[:upper:]"

Strip out non-printable characters from a file:

tr < path/to/file [-cd|--complement --delete] "[:print:]"
ok important lil disclaimer bestie: The examples are provided by the tldr-pages project <https://tldr.sh> under the CC BY 4.0 License. Please note that, as uutils is a work in progress, some examples might fail. so if one of these lowkey flops, it's not you, it's the work-in-progress energy πŸ˜­πŸ’€

and that's the whole page, you ate it πŸ’– mwah. this lil masterpiece was served fresh on 2026-09-25, brought to you by the General Commands Manual crew β€” TR(1), forever our main character πŸ‘‘βœ¨

πŸ“¦ where this page comes from