데이터
Compression / Decompression
Unless otherwise specified, we recommend using the
.tarformat for packages, as this format only bundles files without compressing them. Since images, videos, and other media typically cannot be further compressed, bundling without compression is the fastest and least resource-intensive method for packaging and extracting files.
Since installed ZIP, RAR, and other archivers can only extract or compress a specific type of archive, here is a small utility that supports the following extraction formats: .tar, .zip, .rar, .7z, and the following compression/packaging formats: .zip,.tar
# 下载安装工具
curl -L -o /usr/bin/arc http://webcal-public.ks3-cn-beijing.ksyun.com/tool/arc && chmod +x /usr/bin/arc
# 压缩/打包
arc compress xxx.zip path/to/directory
# 解压
arc decompress xxx.zip
或者解压到指定目录
arc decompress xxx.zip path/to/directory
If you are unable to extract a specific ZIP archive using the commands above or the unzip command, first check the file size. If the file size matches that of the source file, try the following command to extract it:
apt-get update && apt-get install -y fastjar
jar xvf xxx.zip
If the above tools do not work properly, use a standard file compression and decompression program instead:
- Compress and decompress ZIP files
# 压缩。如果没有zip命令,安装命令:apt-get update && apt-get install -y zip
zip -r <自定义压缩包名称>.zip <待压缩目录的路径>
# 解压。如果没有zip命令,安装命令:apt-get update && apt-get install -y unzip
unzip <待解压压缩包名称>.zip -d <解压到哪个路径>
- Compressing and decompressing tar files
# 压缩(具体是指打包,未压缩,非常推荐这种方式,因为压缩/解压都耗时,但是图片等都无法再压缩)
tar -cf <自定义压缩包名称>.tar <待压缩目录的路径>
# 解压
tar -xf <待解压压缩包名称>.tar -C <解压到哪个路径>
- Compress tar.gz and decompress tar.gz
# 压缩
tar -czf <自定义压缩包名称>.tar <待压缩目录的路径>
# 解压
tar -xzf <待解压压缩包名称>.tar -C <解压到哪个路径>
- Unzip the RAR file
# 不推荐使用rar的包,linux下非常不常用
# 解压。如果没有zip命令,安装命令:apt-get update && apt-get install -y unrar
unrar e <待解压压缩包名称>.rar
