UUENCODE(5)

๐Ÿ“ฆ
version 4.15.2 ยท 3 versions
  • 4.15.2 ยท alpine 3.22, alpine 3.23, alpine 3.24, arch rolling, centos-stream 10, centos-stream 9, debian bookworm, debian trixie, fedora 43, fedora 44, nixos 26.05, nixpkgs unstable, opensuse-leap 16.0, ubuntu jammy, ubuntu noble, ubuntu questing, ubuntu resolute, ubuntu stonking (latest)
  • 14.5 ยท freebsd 14.5
  • 15.1 ยท freebsd 15.1, nixpkgs unstable
, in alpine 3.22, alpine 3.23, alpine 3.24, arch rolling, centos-stream 10, centos-stream 9, debian bookworm, debian trixie, fedora 43, fedora 44, nixos 26.05, nixpkgs unstable, opensuse-leap 16.0, ubuntu jammy, ubuntu noble, ubuntu questing, ubuntu resolute, ubuntu stonking

โœจ UUENCODE(5) โœจ

okay bestie, sit down, because today we're decoding the vibe of the uuencode file format โ€” the File Formats Manual entry for it, to be exact. No gatekeeping, let's go ๐Ÿ’…

๐ŸŒธ NAME ๐ŸŒธ

uuencode โ€” the format of an encoded uuencode file. That's it, that's the name, she's simple and she's iconic.


๐ŸŽ€ DESCRIPTION ๐ŸŽ€

So like, files that come out of uuencode(1)? They're built like a little sandwich ๐Ÿฅช โ€” a header line, then a bunch of body lines, then a trailer line. That's the whole structure. Obsessed, honestly.

And here's the chill part: uudecode(1) is so unbothered. It will straight up ignore any lines preceding the header or following the trailer. Extra stuff outside the sandwich? Not her problem. ๐Ÿ’€

BUT. Lines that come before a header must not, of course, look like a header. Like, don't be sneaky. That's the one rule ๐Ÿšจ

the header line, explained ๐Ÿซถ

How do you even spot a header? The first 5 characters have to be begin followed by a space โ€” or else a hyphen and either base64 or encoded or both (also separated with a hyphen).

Let's break down what those words mean, no cap:

  • base64 โ€” says the file has been encoded using base64.
  • encoded โ€” says the output file name has been base64 encoded.

And listen: it is never encoded with traditional uuencoding. Never ever. This whole hyphen situation is a GNU extension, iykyk.

After all that comes a mode (in octal), and then a string which names the remote file. And the mode is separated from the begin clause and the file name by a single space character. One space. Not two. She's precise like that โœจ


๐ŸŒˆ Traditional uuencoding ๐ŸŒˆ

The traditional uuencoded file body is a bunch of lines, and each one is at most 62 characters long (including the trailing newline โ€” yes, the newline counts, she's included).

Each line goes: a character count letter, then the encoded characters, then a newline. That's the order, don't rearrange her.

That character count is a single printing character, and it represents an integer โ€” the number of bytes the rest of the line represents. These integers are always in the range from 0 to 63, and you figure them out by subtracting the character space (octal 40) from the character. Math but make it cute ๐Ÿงฎ

Now the actual encoding tea:

  • Groups of 3 bytes are stored in 4 characters, 6 bits per character.
  • All of them are offset by a space to make the characters printing.
  • The last line may be shorter than the normal 45 bytes.
  • If the size is not a multiple of 3, you can figure that out from the value of the count on the last line.
  • Extra garbage will be included to make the character count a multiple of 4. (yes, literally garbage, and we love her for it ๐Ÿ™ˆ)
  • The body is terminated by a line with a count of zero.
  • That line consists of one ASCII space. Just a little guy. A single space holding the whole thing together ๐Ÿฅน

The trailer line consists of end on a line by itself. Periodt.


๐Ÿฆ‹ base64 encoding ๐Ÿฆ‹

base64 encoded files follow the specified format for the body, but also include a begin-base64 header and a trailer line of four = characters. Four of them. ==== ๐Ÿ’…


๐Ÿ’– EXAMPLES ๐Ÿ’–

begin-base64-encoded 644 VE9ETw==

This introduces a base64 encoded file named, TODO with that name encoded using base64 encoding. She's clean, she's readable, she ate ๐Ÿ”ฅ

begin-encoded 644 5$]$3P``

This introduces an encoded file named, TODO with that name encoded using uuencoding.

The encoding is a lot less friendly. Please prefer base64 encoding. Fr fr, take the advice ๐Ÿ™

๐Ÿ‘‘ CONFORMING TO ๐Ÿ‘‘

  • IEEE Std 1003.1, plus extensions

And a little lore drop: the -encoded suffix to the begin header line is a GNU extension. Recipients must have the GNU uudecode program to decode them. No GNU uudecode, no decode. That's the deal ๐Ÿซก


๐ŸŒŸ SEE ALSO ๐ŸŒŸ


๐Ÿ•ฐ๏ธ HISTORY ๐Ÿ•ฐ๏ธ

The uuencode file format appeared in BSD 4.0. Ancient. Elder icon behavior, honestly โญ


and that's the whole page bestie!! this was the UUENCODE(5) entry from the File Formats Manual, living right alongside all her sibling pages, and yes she's still rocking that same UUENCODE(5) footer energy like the legend she is. go forth and decode responsibly ๐Ÿ’œโœจ๐ŸŽ€

๐Ÿ“ฆ where this page comes from