UUENCODE(1P)
πΈ UUENCODE(1P) β the POSIX Programmer's Manual, but make it make sense πΈ
okay bestie, sit down, hydrate, because we're doing uuencode(1P) and it's literally the moment your fave binary file learns to travel. this page is from the POSIX Programmer's Manual. π
π PROLOG
so like, heads up: this manual page is part of the POSIX Programmer's Manual. the Linux implementation of this interface may differ (so pls go consult the corresponding Linux manual page for the deets on Linux behavior), or honestly the interface may not even be implemented on Linux at all. not me warning you first thing π
β¨ NAME
uuencode β encode a binary file π¦
like. it takes your file and makes it text. that's the whole vibe.
π SYNOPSIS
uuencode [-m] [file] decode_pathname
π DESCRIPTION
okay so here's the tea. the uuencode utility shall write an encoded version of the named input file β or standard input if you didn't name a file, no judgement β to standard output. π
the output shall be encoded using one of the algorithms described in the STDOUT section (there's two of them, we'll get there, don't stress), and it shall include the file access permission bits of the input file (in chmod octal or symbolic notation, yes both, iconic) plus the decode_pathname, so the file can be re-created on another system that conforms to this volume of POSIX.1β2017. it's giving teleportation but for files. π§
π OPTIONS
the uuencode utility shall conform to the Base Definitions volume of POSIX.1β2017, Section 12.2, Utility Syntax Guidelines. we love a rule-follower.
the following option shall be supported by the implementation:
-mβ encode the output using the MIME Base64 algorithm described in STDOUT. if-mis not specified, the historical algorithm described in STDOUT shall be used. so like, no-m= vintage era,-m= modern era. choose your fighter π«Ά
π OPERANDS
the following operands shall be supported:
decode_pathnameβ the pathname of the file into which theuudecodeutility shall place the decoded file. specifying adecode_pathnameoperand of/dev/stdoutshall indicate thatuudecodeis to use standard output. and bestie, listen: if there are characters indecode_pathnamethat are not in the portable filename character set, the results are unspecified. unspecified = we do not know = chaos. don't do it. πfileβ a pathname of the file to be encoded. the main character of this whole operation honestly.
π STDIN
see the INPUT FILES section. it's right below. we're keeping it moving. β¨
π¦ INPUT FILES
input files can be files of any type. any. type. no gatekeeping here. π
β ENVIRONMENT VARIABLES
the following environment variables shall affect the execution of uuencode:
LANGβ provide a default value for the internationalization variables that are unset or null. (see the Base Definitions volume ofPOSIX.1β2017, Section 8.2, Internationalization Variables for the precedence of internationalization variables used to determine the values of locale categories.)LC_ALLβ if set to a non-empty string value, override the values of all the other internationalization variables. she's the boss fr fr.LC_CTYPEβ determine the locale for the interpretation of sequences of bytes of text data as characters (for example, single-byte as opposed to multi-byte characters in arguments and input files).LC_MESSAGESβ determine the locale that should be used to affect the format and contents of diagnostic messages written to standard error.NLSPATHβ determine the location of message catalogs for the processing ofLC_MESSAGES.
π ASYNCHRONOUS EVENTS
default. that's it. that's the section. periodt. β¨
π STDOUT
π§ uuencode Base64 Algorithm
the standard output shall be a text file (encoded in the character set of the current locale) that begins with the line:
"begin-base64 %s %s\n", <mode>, <decode_pathname>
and ends with the line:
"====\n"
in both cases, the lines shall have no preceding or trailing <blank> characters. none. zero. do not add a lil space for vibes. π
okay now the actual encoding, stay with me:
the encoding process represents 24-bit groups of input bits as output strings of four encoded characters. proceeding from left to right, a 24-bit input group shall be formed by concatenating three 8-bit input groups. each 24-bit input group then shall be treated as four concatenated 6-bit groups, each of which shall be translated into a single digit in the Base64 alphabet. when encoding a bit stream via the Base64 encoding, the bit stream shall be presumed to be ordered with the most-significant bit first. that is, the first bit in the stream shall be the high-order bit in the first byte, and the eighth bit shall be the low-order bit in the first byte, and so on. each 6-bit group is used as an index into an array of 64 printable characters, as shown in Table 4-22, uuencode Base64 Values.
Table 4-22: uuencode Base64 Values
- Value
0βAΒ· Value17βRΒ· Value34βiΒ· Value51βz - Value
1βBΒ· Value18βSΒ· Value35βjΒ· Value52β0 - Value
2βCΒ· Value19βTΒ· Value36βkΒ· Value53β1 - Value
3βDΒ· Value20βUΒ· Value37βlΒ· Value54β2 - Value
4βEΒ· Value21βVΒ· Value38βmΒ· Value55β3 - Value
5βFΒ· Value22βWΒ· Value39βnΒ· Value56β4 - Value
6βGΒ· Value23βXΒ· Value40βoΒ· Value57β5 - Value
7βHΒ· Value24βYΒ· Value41βpΒ· Value58β6 - Value
8βIΒ· Value25βZΒ· Value42βqΒ· Value59β7 - Value
9βJΒ· Value26βaΒ· Value43βrΒ· Value60β8 - Value
10βKΒ· Value27βbΒ· Value44βsΒ· Value61β9 - Value
11βLΒ· Value28βcΒ· Value45βtΒ· Value62β+ - Value
12βMΒ· Value29βdΒ· Value46βuΒ· Value63β/ - Value
13βNΒ· Value30βeΒ· Value47βvΒ· (pad) β= - Value
14βOΒ· Value31βfΒ· Value48βw - Value
15βPΒ· Value32βgΒ· Value49βx - Value
16βQΒ· Value33βhΒ· Value50βy
the character referenced by the index shall be placed in the output string. simple as that bestie. π
the output stream (encoded bytes) shall be represented in lines of no more than 76 characters each. all line breaks or other characters not found in the table shall be ignored by decoding software (see uudecode). so your decoder is not gonna be dramatic about it.
special processing shall be performed if fewer than 24 bits are available at the end of a message or encapsulated part of a message. a full encoding quantum shall always be completed at the end of a message. when fewer than 24 input bits are available in an input group, zero bits shall be added (on the right) to form an integral number of 6-bit groups. output character positions that are not required to represent actual input data shall be set to the character '='. since all Base64 input is an integral number of octets, only the following cases can arise:
- the final quantum of encoding input is an integral multiple of 24 bits; here, the final unit of encoded output shall be an integral multiple of 4 characters with no
'='padding. - the final quantum of encoding input is exactly 16 bits; here, the final unit of encoded output shall be three characters followed by one
'='padding character. - the final quantum of encoding input is exactly 8 bits; here, the final unit of encoded output shall be two characters followed by two
'='padding characters.
a terminating "====" evaluates to nothing and denotes the end of the encoded data. it's giving β¨the endβ¨.
πΈ uuencode Historical Algorithm
the standard output shall be a text file (encoded in the character set of the current locale) that begins with the line:
"begin %s %s\n" <mode>, <decode_pathname>
and ends with the line:
"end\n"
in both cases, the lines shall have no preceding or trailing <blank> characters. again. still. forever. π
the algorithm that shall be used for lines in between begin and end takes three octets as input and writes four characters of output by splitting the input at six-bit intervals into four octets, containing data in the lower six bits only. these octets shall be converted to characters by adding a value of 0x20 to each octet, so that each octet is in the range [0x20,0x5f], and then it shall be assumed to represent a printable character in the ISO/IEC 646:1991 standard encoded character set. it then shall be translated into the corresponding character codes for the codeset in use in the current locale. (for example, the octet 0x41, representing 'A', would be translated to 'A' in the current codeset, such as 0xc1 if it were EBCDIC.) historic. vintage. iconic honestly. π
where the bits of two octets are combined, the least significant bits of the first octet shall be shifted left and combined with the most significant bits of the second octet shifted right. thus the three octets A, B, C shall be converted into the four octets:
0x20 + (( A >> 2 ) & 0x3F)
0x20 + (((A << 4) | ((B >> 4) & 0xF)) & 0x3F)
0x20 + (((B << 2) | ((C >> 6) & 0x3)) & 0x3F)
0x20 + (( C ) & 0x3F)
these octets then shall be translated into the local character set.
each encoded line contains a length character, equal to the number of characters to be decoded plus 0x20 translated to the local character set as described above, followed by the encoded characters. the maximum number of octets to be encoded on each line shall be 45. forty-five. write it down. ποΈ
π«Ά STDERR
the standard error shall be used only for diagnostic messages. she's for emergencies only bestie, don't chat there. π
π OUTPUT FILES
none. nothing. empty. the void. π
π EXTENDED DESCRIPTION
none. again, the void. we respect a short section. β¨
β EXIT STATUS
the following exit values shall be returned:
0β successful completion. slay. π>0β an error occurred. π
π CONSEQUENCES OF ERRORS
default.
the following sections are informative.
β¨ APPLICATION USAGE β¨
okay so first thing bestie: this file gets expanded by 35 percent π like each three octets become four, plus control information on top, so it's gonna take longer to transmit. it's giving "worth it but slow" energy.
- this utility is here to create files for
data interchange between systems with possibly different codesets, and torepresent binary data as a text file. so theISO/IEC 646:1991standard was chosen as a midpoint in the algorithm β a known reference point, periodt. π - the output from
uuencodeis a text file on the local system. but if the output were in theISO/IEC 646:1991standard codeset, it might not be a text file (at least because the<newline>characters might not match), and that would defeat the whole goal of creating a text file. π - if this text file was then carried to another machine with the same codeset, it would be perfectly compatible with that system's
uudecode. slay. - if it was transmitted over a mail system or sent to a machine with a different codeset, it is assumed that, as for every other text file, some
translation mechanismwould convert it (by the time it reached a user on the other system) into an appropriate codeset. β¨ - this translation only makes sense from the local codeset, not if the file has been put into a
ISO/IEC 646:1991standard representation first. so order matters, bestie. - similarly, files processed by
uuencodecan be placed inpaxarchives, intermixed with other text files in the same codeset. π
π¦ EXAMPLES π¦
None. like literally none, bestie β the examples section said "None." and we respect that. π
π RATIONALE π
- A new algorithm was added at the request of the international community to parallel work in
RFC 2045(MIME). international besties said "we need this" and it happened. - As with the historical
uuencodeformat, theBase64 Content-Transfer-Encodingis designed to represent arbitrary sequences of octets in a form that is not humanly readable. π a 65-character subset of theISO/IEC 646:1991standard is used, enabling6 bitsto be represented per printable character. (the extra 65th character,'=', is used to signify a special processing function.) β¨ - This subset has the important property that it is represented identically in all versions of the
ISO/IEC 646:1991standard, includingUS ASCII, and all characters in the subset are also represented identically in all versions ofEBCDIC. the historicaluuencodealgorithm does not share this property, which is the reason that a second algorithm was added to theISO POSIXβ2standard. so that's the tea. β - The string
"===="was used for the termination instead of the end used in the original format because the latter is a string that could be valid encoded input. smart, honestly. π§ - In an early draft, the
-moption was named-b(for Base64), but it was renamed to reflect its relationship to theRFC 2045. a-uwas also present to invoke the default algorithm, but since this was not historical practice, it was omitted as being unnecessary. character development. π - See the
RATIONALEsection inuudecodefor the derivation of the/dev/stdoutsymbol. iykyk. π«Ά
π FUTURE DIRECTIONS π
None. the future said "no notes". π
π SEE ALSO π
chmod,mailx,uudecode- The Base Definitions volume of
POSIX.1β2017,Chapter 8,Environment Variables,Section 12.2,Utility Syntax Guidelines
π COPYRIGHT π
- Portions of this text are reprinted and reproduced in electronic form from
IEEE Std 1003.1-2017,Standard for Information Technology -- Portable Operating System Interface (POSIX),The Open Group Base Specifications Issue 7, 2018 Edition,Copyright (C) 2018by theInstitute of Electrical and Electronics Engineers, IncandThe Open Group. In the event of any discrepancy between this version and the original IEEE and The Open Group Standard, the original IEEE and The Open Group Standard is the referee document. The original Standard can be obtained online athttp://www.opengroup.org/unix/online.html. no cap, that's the whole legal tea. β - Any typographical or formatting errors that appear in this page are most likely to have been introduced during the conversion of the source files to man page format. To report such errors, see
https://www.kernel.org/doc/man-pages/reporting_bugs.html. if you spot a typo, tell the kernel besties. π
okay that's the whole page, bestie π this iconic manual page is from IEEE/The Open Group, 2017, and it's UUENCODE(1P). go forth and encode slayfully. πβ¨
π¦ where this page comes from
- alpine 3.22: man-pages-posix 2017a-r0 Β· custom
- alpine 3.23: man-pages-posix 2017a-r0 Β· custom
- alpine 3.24: man-pages-posix 2017a-r0 Β· custom
- arch rolling: man-pages 6.19-1
- arch rolling: man-pages 6.20-1 Β· BSD-2-Clause AND BSD-3-Clause AND BSD-4.3TAHOE AND BSD-4-Clause-UC AND GPL-1.0-or-later AND GPL-2.0-only AND GPL-2.0-or-later AND GPL-3.0-or-later AND LGPL-3.0-linking-exception AND LGPL-3.0-or-later AND LicenseRef-Public-Domain AND LicenseRef-UltraPermissive AND Linux-man-pages-1-para AND Linux-man-pages-copyleft AND Linux-man-pages-copyleft-2-para AND Linux-man-pages-copyleft-var AND MIT AND Spencer-94
- nixpkgs unstable: man-pages-posix 2017a
- opensuse-leap 16.0: man-pages-posix 2017a-160000.4.1 Β· SUSE-IEEE
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms