Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I found an obfuscated e-mail address that can be decrypted using this command:

echo "cbyrzba@cbyrzba.bet" | tr '[a-z]' '[n-za-m]'

How does that output a valid e-mail address? What is that command doing?

share|improve this question
up vote 9 down vote accepted

tr's man page explains it pretty well; it's a filter that converts characters from one set to another. The first set specified is [a-z], which is a shorthand way of typing [abcdefghijklmnopqrstuvwxyz]. The second is [n-za-m], which turns into [nopqrstuvwxyzabcdefghijklm]. tr reads each character from stdin, and if it appears in the first set, it replaces it with the character in the same position in the second set (this means [ and ] are getting replaced with themselves, so including them was pointless, but a lot of people do it by mistake because regular expressions use them to represent character classes so they think tr requires them).

So a simpler example:

$ echo abc | tr ab xy

a turned into x, b turned into y, and c was left unchanged because it wasn't in the first set. All the user did in this case is run their e-mail address through the same filter (since it's symmetric -- a maps to n and n back to a, etc.) to get the rotated version; you running it through again swaps all the characters back to their originals

Sidenote: This particular swap, where each letter is replaced by the one 13 characters away from it in the alphabet, is called ROT13 (rotate 13); it was popular on newsgroups as a way to hide things people might not want to see

share|improve this answer

tr transliterates characters: for some character x in the input, it outputs a character y.

tr takes two command line arguments, the "from" characters and the "to" characters.

In your example above, the "from characters" are given as '[a-z]'. The "to characters" are given as '[n-za-m]' . The single-quotes keep the shell that interprets the command line from doing anything to the two arguments. tr treats square-bracketed arguments as ranges. So '[a-z]' means "all lower case characters from 'a' to 'z', inclusive". The second argument is a bit more complicated,'[n-za-m]'` means "lower case characters from 'n' to 'z' inclusive, and lower-case characters from 'a' to 'm', inclusive'.

tr transliterates all input 'a' characters to 'n', 'b' to 'm', 'c' to 'o', etc, up to 'n' characters output as 'z'. 'o' characters in input get output as 'a', 'p' to 'b', 'q' to 'c' and so forth. 'z' characters in input get output as 'l'.

Essentially, your command does a Caesar Cipher on its input, one lower case character at a time. Someone had to encipher "polemon@polemon.org" to get the string you have echo outputing.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.