- zip/unzip
Mac自带解压缩工具,可解压缩zip压缩包。
zip压缩:
在文件夹下创建如下文件
> ls *.txt
1.txt 2.txt 3.txt 4.txt
执行命令
> zip -r txt.zip *.txt
生成压缩包
> ls *.zip
txt.zip
查看压缩包内的文件,有两种方法,用zip/和unzip都可以
> zip -sf txt.zip
Archive contains:
1.txt
2.txt
3.txt
4.txt
Total 4 entries (0 bytes)
> unzip -l txt.zip
Archive: txt.zip
Length Date Time Name
--------- ---------- ----- ----
0 09-02-2018 09:48 1.txt
0 09-02-2018 09:48 2.txt
0 09-02-2018 09:48 3.txt
0 09-02-2018 09:48 4.txt
--------- -------
0 4 files
将压缩文件解压到当前目录的txt文件夹下
> unzip txt.zip -d txt
Archive: txt.zip
extracting: txt/1.txt
extracting: txt/2.txt
extracting: txt/3.txt
extracting: txt/4.txt
完成。
- rar/unrar
下载地址
在Mac下用rar压缩比较少,所以主要用的是unrar解压,简单命令如下:
想要解压到的目录必须事先创建好,否则解压会失败。
> ./unrar e txt.rar ./txt
UNRAR 5.50 beta 6 freeware Copyright (c) 1993-2017 Alexander Roshal
Extracting from txt.rar
Extracting ./txt/acknow.txt OK
Extracting ./txt/license.txt OK
Extracting ./txt/rar.txt OK
Extracting ./txt/readme.txt OK
Extracting ./txt/whatsnew.txt OK
All OK
完成。
- 7z
> ./7za e txt.7z -otxt
-o后面加解压路径,没有空格。
完成。