In the old times, there were different data or file transfer methods. Modems were popular at that time and this may create data related to encoding problems.
uuencode is a command which will be used to encode given data or files into ASCII format. Converting ASCII format will prevent problems related Control Carachter.
The syntax of the
uuencode is very simple.
uuencode FLAG INFILE OUTFILE
Here flag is used to change
INFILE is optional and used to provide input data.
OUTFILE is the converted data or file to be created.
Help information about
uuencode can be listed with the
--help option like below.
$ uuencode --help
Encode Given File
The most popular use case and usage for
uuencode are encoding the given file. We will provide the file named
test.tar.gz as input file and create output filename
$ uuencode test.tar.gz test.tar.gz.uu
Decode Given File
We can decode given files and data with the
-c option like below. We will redirect file named
test.tar.gz.uu like below.
$ uuencode -c < test.tar.gz.uu
Decode and Extract
If we want to decode and extract compressed file we can pipe them each other. In this example, we will use
tar in order to decode and extract files.
$ uudecode -o /dev/stdout < test.tar.gz.uu | gunzip | tar xfv -
Convert Using Base64
uuencode supports Base64 encoding. We can use
--base64 option in order to enable Base64 format.
$ uuencode --base64 test.tar.gz test.tar.gz.uu