先略写,以后有空了再详细学习一下

tar

很多地方都能下载到.tar.tar.gz文件,tar命令本来是用来备份/归档的,没有压缩功能如果后面又跟上了.gz或者其他压缩算法,则说明是被压缩的

tar命令很复杂,详情可以看菜鸟教程,这里先贴个tldr的解释,涵盖了日常用法

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
tldr tar

Archiving utility.
Often combined with a compression method, such as gzip or bzip.
- Create an archive from files:
tar cf target.tar file1 file2 file3
- Create a gzipped archive:
tar czf target.tar.gz file1 file2 file3
- Extract an archive in a target folder:
tar xf source.tar -C folder
- Extract a gzipped archive in the current directory:
tar xzf source.tar.gz
- Extract a bzipped archive in the current directory:
tar xjf source.tar.bz2
- Create a compressed archive, using archive suffix to determine the compression program:
tar caf target.tar.xz file1 file2 file3
- List the contents of a tar file:
tar tvf source.tar
- Extract files matching a pattern:
tar xf source.tar --wildcards "*.html"

zip

转载至 https://www.cnblogs.com/pandabang/p/10983350.html,以后再慢慢整理

功能 命令行输入的命令
压缩单个文件 zip package.zip file
压缩多个文件 zip package.zip file1 file2
压缩单个文件夹 zip -r package.zip folder
压缩多个文件夹 zip -r package.zip folder1 folder2
压缩文件、文件夹 zip -r package.zip file1 folder1 file2
压缩时加密码 zip -e package.zip file
解压缩 unzip package.zip