Linux unar extract archive file content

If you don’t know which command to use to decompress such as .rar format, you can use the unar command, unar is a universal decompression, no need to add any parameters, and automatically recognize the format to decompress. Use unar to perfectly solve the problem of decompressing Chinese garbled characters

Install

yum -y install unar

parameter options

-output-directory (-o) <string>    要将存档内容写入其中的目录。默认为当前目录。如果设置为单个破折号(-),则不会创建任何文件,并且所有数据将输出到标准输出
-force-overwrite (-f)              当要解压缩的文件在磁盘上已经存在时,总是覆盖文件。默认情况下,如果可能,程序会询问用户,否则会跳过该文件
-force-rename (-r)                 当要解压缩的文件在磁盘上已经存在时,总是重命名文件
-force-skip (-s)                   当要解压缩的文件在磁盘上已经存在时,总是跳过文件
-force-directory (-d)              始终为解压缩归档文件的内容创建一个包含目录。默认情况下如果有多个顶级文件或文件夹,则创建一个目录
-no-directory (-D)                 永远不要为解压缩归档文件的内容创建内容目录。
-password (-p) <string>            用于解密受保护档案的密码
-encoding (-e) <encoding name>     当不知道归档文件中的文件名时,指定要使用的编码。如果未指定程序将尝试自动检测所使用的编码。 使用"help""list"作为参数给出所有支持编码的列表。
-password-encoding (-E) <name>     当存档的密码未知时,要用于该密码的编码。如果未指定,则使用-encoding选项给出的编码或自动检测的编码
-indexes (-i)                      不将要解包的文件指定为文件名或通配符模式,而是将它们指定为索引,作为lsar的输出
-no-recursion (-nr)                不要试图提取包含在其他档案中的档案。例如,在解压缩a.tar.gz文件时,只解压缩.gz文件而不解压缩其内容
-copy-time (-t)                    将文件修改时间从归档文件复制到包含目录(如果创建了一个目录)
-forks (-k) <visible|hidden|skip>  如何处理Mac OS资源分叉。"visible"创建扩展名为"的AppleDouble文件。".rsrc","hidden"创建前缀为"的AppleDouble文件._”和“skip”将丢弃所有的资源分支。默认为“visible”
-quiet (-q)                        在安静模式下运行
-version (-v)                      打印版本并退出
-help (-h)                         显示此信息

How to solve the problem of garbled characters when decompressing files in Linux system

Under normal circumstances, the unar command can self-adaptively encode and decompress files. If there are Chinese garbled characters, you can solve it by specifying the decompression encoding method. Use the lsar command to view
the files in the compressed package. Chinese name, specify to use this encoding to decompress the file!
lsar -e GB18030unar -e GB18030 ***.tar.xz

example

List archive contents

lsar test.zip

Unzip the compressed package

unar test.zip

Life, simple is good; Life, quiet is good.

Guess you like

Origin blog.csdn.net/qq_50573146/article/details/130328851