[英]How do I make a zip file on linux?
zip -h is confusing! zip -h令人困惑! I just want to know how to make a .zip from a directory.
我只想知道如何从目录中创建.zip。 kthxbi
kthxbi
zip -r archive.zip dir_to_zip
from 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...
Even if it functions well I would like to propose you 7z( http://www.7-zip.org/ ). 即使它运行良好,我也想向您推荐7z( http://www.7-zip.org/ )。
7za a directory.7z directory
It has a better compression and it is opensource , GNU LGPL license, freely available for windows,linux,BSD... 它具有更好的压缩效果,并且是开放源代码 ,GNU LGPL许可证,可免费用于Windows,Linux,BSD ...
BTW it creates/opens 7z, XZ, BZIP2, GZIP, TAR, ZIP and WIM, 顺便说一句,它会创建/打开7z,XZ,BZIP2,GZIP,TAR,ZIP和WIM,
and open unpack only: ARJ, CAB, CHM, CPIO, CramFS, DEB, DMG, FAT, HFS, ISO, LZH, LZMA, MBR, MSI, NSIS, NTFS, RAR, RPM, SquashFS, UDF, VHD, WIM, XAR and Z. 且仅打开解压缩:ARJ,CAB,CHM,CPIO,CramFS,DEB,DMG,FAT,HFS,ISO,LZH,LZMA,MBR,MSI,NSIS,NTFS,RAR,RPM,SquashFS,UDF,VHD,WIM,XAR和Z。
[They should pay me for advertisement :-)] [他们应该付我广告费用:-)]
I think this is gonna help you 我想这会帮到你
zip -r new_zip_file directory_name
Where "new_zip_file" is the name of the .zip file you want to create and "directory_name" is the folder you want compress in zip. 其中“ new_zip_file”是要创建的.zip文件的名称,“ directory_name”是要压缩为zip的文件夹。
On linux, although it can zip you really should instead be using : 在linux上,尽管它可以压缩,但实际上您应该使用:
to compress 压缩
tar -jcvf archive_name.tar /path/to/directory_to_compress
where archive_name.tar will be the the compressed version of the input dir /path/to/directory_to_compress 其中archive_name.tar将是输入目录/ path / to / directory_to_compress的压缩版本
to decompress 解压缩
tar -xvf archive_name.tar
This should be quite easy and short 这应该很容易而且简短
compressing 压缩
tar -zcvf filename.tar myflie.sql
Decompressing 解压缩
tar -xvzf filename
For more interested in knowing usage options 对于了解使用选项的更多兴趣
z - filter achieving through gzip z-通过gzip实现的过滤器
j - filter achieve through bzip2 j-通过bzip2实现过滤
c - create achieve file c-创建实现文件
v - show the progress v-显示进度
x - extract achieve file x-提取实现文件
f - file name f-文件名
cheers 干杯
Typically one uses tar to create an uncompressed archive and either gzip or bzip2 to compress that archive. 通常,人们使用tar创建未压缩的存档,并使用gzip或bzip2压缩该存档。 The corresponding gunzip and bunzip2 commands can be used to uncompress said archive, or you can just use flags on the tar command to perform the uncompression.
可以使用相应的gunzip和bunzip2命令解压缩所述存档,或者您可以仅使用tar命令上的标志来执行解压缩。
If you are referring specifically to the Zip file format, you can simply use the zip and unzip commands. 如果您专门指的是Zip文件格式,则只需使用zip和unzip命令。
To compress: 压缩:
zip squash.zip file1 file2 file3
or to zip a directory 或压缩目录
zip -r squash.zip dir1
To uncompress: 解压缩:
unzip squash.zip
this unzips it in your current working directory. 这会将其解压缩到您当前的工作目录中。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.