TR(1)
π TR(1) β or, the translate/deletes-characters girlie π
hiii bestie, welcome to the tr(1) page from the User Commands manual β¨ this is the tool that takes characters on stdin, does a lil glow-up on them, and hands them back on stdout. she's simple, she's iconic, she's in every shell script you've ever copy-pasted. let's go π«Ά
πΈ NAME πΈ
tr β translate or delete characters π
β¨ SYNOPSIS β¨
tr [OPTION]... STRING1 [STRING2]
π¦ DESCRIPTION π¦
okay so here's the whole vibe: tr translates, squeezes, and/or deletes characters from standard input, and writes the result to standard output. π« Your STRING1 and STRING2 are what spell out the character arrays ARRAY1 and ARRAY2, which are literally the things that control what action happens. no cap.
Here's the flag menu, and yes every single one is here π
-c,-C,--complementβ use the complement ofARRAY1(i.e. everything she's not listing)-d,--deleteβ delete the characters inARRAY1, do not translate. just straight up removal, rip π-s,--squeeze-repeatsβ replace each sequence of a repeated character that's listed in the last specifiedARRAY, with a single occurrence of that character π«§-t,--truncate-set1β first truncateARRAY1to length ofARRAY2βοΈ--helpβ display this help and exit π₯°--versionβ output version information and exit π¦
π how you write ARRAYs π
ARRAYs are specified as strings of characters. Most represent themselves (so boring, so reliable). But the interpreted sequences are where the drama lives β here's the full list, don't skip a single one:
\NNNβ character with octal valueNNN(1 to 3 octal digits) π’\\β backslash\aβ audible BEL π\bβ backspace\fβ form feed\nβ new line\rβ return\tβ horizontal tab\vβ vertical tabCHAR1-CHAR2β all characters fromCHAR1toCHAR2in ascending order π[CHAR*]β inARRAY2, copies ofCHARuntil length ofARRAY1[CHAR*REPEAT]βREPEATcopies ofCHAR,REPEAToctal if starting with 0[:alnum:]β all letters and digits[:alpha:]β all letters[:blank:]β all horizontal whitespace[:cntrl:]β all control characters[:digit:]β all digits[:graph:]β all printable characters, not including space[:lower:]β all lower case letters[:print:]β all printable characters, including space[:punct:]β all punctuation characters[:space:]β all horizontal or vertical whitespace[:upper:]β all upper case letters[:xdigit:]β all hexadecimal digits[=CHAR=]β all characters which are equivalent toCHAR
π« the actual mechanics, bestie π«
Translation occurs if -d is not given and both STRING1 and STRING2 appear. -t is only significant when translating. ARRAY2 is extended to length of ARRAY1 by repeating its last character as necessary. Excess characters of ARRAY2 are ignored. Character classes expand in unspecified order; while translating, [:lower:] and [:upper:] may be used in pairs to specify case conversion. Squeezing occurs after translation or deletion.
β οΈ okay important: arguments like [...] should be quoted, to avoid potential shell globbing. your shell will absolutely try to eat your brackets if you let it. quote it, queen π
π BUGS π
Full support is available only for safe single-byte locales, in which every possible input byte represents a single character. The C locale is safe in GNU systems, so you can dodge this whole issue in the shell by running LC_ALL=C tr instead of plain tr. slay π
π«Ά AUTHOR π«Ά
Written by Jim Meyering. king behavior, honestly.
π£ REPORTING BUGS π£
- Report bugs to:
bug-coreutils@gnu.org - GNU coreutils home page:
https://www.gnu.org/software/coreutils/ - General help using GNU software:
https://www.gnu.org/gethelp/ - Report any translation bugs to
https://translationproject.org/team/
π SEE ALSO π
- Full documentation
https://www.gnu.org/software/coreutils/tr - or available locally via:
info '(coreutils) tr invocation'
okay and for the record, this build was Packaged by Ubuntu (9.10-1ubuntu2) π
Copyright Β© 2026 Free Software Foundation, Inc. License GPLv3+: GNU GPL version 3 or later https://gnu.org/licenses/gpl.html. This is free software: you are free to change and redistribute it. There is NO WARRANTY, to the extent permitted by law. π
and that's the whole page bestie, mwah π this was GNU coreutils 9.10, dated August 2026 β go translate something iconic with her, you got this π¦β¨π
π¦ where this page comes from
- ubuntu stonking: gnu-coreutils 9.10-1ubuntu2 Β· GPL-3.0-or-later
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms