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.
在过去,存在不同的数据或文件传输方法。 当时的调制解调器很流行,这可能会创建与编码问题有关的数据。 uuencode
是一个命令,用于将给定的数据或文件编码为ASCII格式。 转换ASCII格式将防止与Control Carachter相关的问题。
句法 (Syntax)
The syntax of the uuencode
is very simple.
uuencode
的语法非常简单。
uuencode FLAG INFILE OUTFILE
Here flag is used to change uuencode
behaivour. INFILE
is optional and used to provide input data. OUTFILE
is the converted data or file to be created.
此处的标志用于更改uuencode
行为。 INFILE
是可选的,用于提供输入数据。 OUTFILE
是要创建的转换后的数据或文件。
帮帮我 (Help)
Help information about uuencode
can be listed with the --help
option like below.
可以使用--help
选项列出有关uuencode
帮助信息,如下所示。
$ 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 test.tar.gz.uu
.
uuencode
最流行的用例和用法是对给定文件进行编码。 我们将提供名为test.tar.gz
的文件作为输入文件,并创建输出文件名test.tar.gz.uu
$ 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.
我们可以使用-c
选项解码给定的文件和数据,如下所示。 我们将像下面这样重定向名为test.tar.gz.uu
文件。
$ 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 gunzip
and tar
in order to decode and extract files.
如果我们想解码和提取压缩文件,我们可以互相管道传输。 在此示例中,我们将使用gunzip
和tar
来解码和提取文件。
$ uudecode -o /dev/stdout < test.tar.gz.uu | gunzip | tar xfv -
使用Base64转换 (Convert Using Base64)
uuencode
supports Base64 encoding. We can use -m
or--base64
option in order to enable Base64 format.
uuencode
支持Base64编码。 我们可以使用-m
或--base64
选项来启用Base64格式。
$ uuencode --base64 test.tar.gz test.tar.gz.uu
翻译自: https://www.poftut.com/linux-uuencode-command-tutorial-with-examples/