linux - 我如何在 linux 上制作一个 zip 文件?

标签 linux zip command-line-interface

zip -h 令人困惑!我只想知道如何从目录制作 .zip。 kthxbi

最佳答案

zip -r archive.zip dir_to_zip

来自 man zip

-r  
   --recurse-paths
          Travel the directory structure recursively; for example:

                 zip -r foo.zip foo

          or more concisely

                 zip -r foo foo

In  this  case, all  the  files and directories in foo are saved in a zip archive
named foo.zip,including files with names starting with ".", since  the  recursion
does not use the shell's file-name substitution mechanism...

即使它运行良好,我也想向您推荐 7z( http://www.7-zip.org/ )。

  7za a directory.7z  directory

它有更好的压缩,并且是开源,GNU LGPL 许可证,可免费用于 windows、linux、BSD...

顺便说一句,它创建/打开 7z、XZ、BZIP2、GZIP、TAR、ZIP 和 WIM,
仅打开解包:ARJ、CAB、CHM、CPIO、CramFS、DEB、DMG、FAT、HFS、ISO、LZH、LZMA、MBR、MSI、NSIS、NTFS、RAR、RPM、SquashFS、UDF、VHD、WIM、XAR和 Z。

[他们应该付钱给我做广告:-)]

关于linux - 我如何在 linux 上制作一个 zip 文件?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/24418651/

相关文章:

linux - 如果我退出终端,远程服务器上的 zip -r 命令会被取消吗?

git - 如何使用 cli 获取当前分支的 Github 最新提交 url

linux - bash 中文件列表的良好输出

linux - Apache 时间与操作系统日期和时间不同?

linux - 从文本文件第一行的开头删除匹配的模式

javascript - 内存中创建的 Zip 文件已损坏

linux - 未定义对 `__gcov_exit' 的引用?

python - 如何在python中直接将文件添加到zip?

java - 如何在 CLI 应用程序中显示 "intercept"Ctrl+C?

python - Python click 模块没有输出?