搜索
查看: 4767|回复: 0

kali linux压缩命令常用:tar,tgz,gzip,zip

[复制链接]

152

主题

99

回帖

540

积分

高级会员

中国黑客

积分
540
QQ
发表于 2018-6-3 17:15:16 来自手机 | 显示全部楼层 |阅读模式 来自 甘肃
linux压缩命令常用的有三个:tar,tgz,gzip,zip

一,tar

(一) tar压缩命令
[pre]
tar -cvf examples.tar files|dir
#说明:
-c, --create  create a new archive 创建一个归档文件
-v, --verbose verbosely list files processed 显示创建归档文件的进程
-f, --file=ARCHIVE use archive file or device ARCHIVE  后面要立刻接被处理的档案名,比如--file=examples.tar

#举例:
tar -cvf file.tar file1       #file1文件
tar -cvf file.tar file1 file2 #file1,file2文件
tar -cvf file.tar dir         #dir目录
[/pre]

(二) tar 解压命令
[pre]
tar -xvf examples.tar (解压至当前目录下)
tar -xvf examples.tar  -C /path (/path 解压至其它路径)
[/pre]
#说明:
-x, --extract, extract files from an archive 从一个归档文件中提取文件

#举例:
[pre]
tar -xvf file.tar
tar -xvf file.tar -C /temp  #解压到temp目录下
[/pre]
二,tgz

(一) tgz压缩命令(tar.gz,tgz格式是相同的,命名不同而已)

tar -zcvf examples.tgz examples (examples当前执行路径下的目录)

说明:
-z, --gzip filter the archive through gzip 通过gzip压缩的形式对文件进行归档

举例:
[pre]
tar -zcvf file.tgz dir #dir目录
[/pre]
(二) tgz 解压命令

tar -zxvf examples.tar (解压至当前执行目录下)
tar -zxvf examples.tar  -C /path (/path 解压至其它路径)

举例:
[pre]
tar -zcvf file.tgz
tar -zcvf file.tgz -C /temp
[/pre]
三,gzip

(一)gzip压缩:
[pre]
gzip -d examples.gz examples
[/pre]
(二)gzip解压:
[pre]
gunzip examples.gz
[/pre]
四,zip
zip 格式是开放且免费的,所以广泛使用在 Windows、Linux、MacOS 平台,要说 zip
有什么缺点的话,就是它的压缩率并不是很高,不如 rar及 tar.gz 等格式。
压缩:
[pre]
zip -r examples.zip examples (examples为目录)
[/pre]
解压:
[pre]
zip examples.zip
[/pre]
六 .rar

压缩:
[pre]
rar -a examples.rar examples
[/pre]
解压:
[pre]
rar -x examples.rar
[/pre]
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 注册

本版积分规则

快速回复 返回顶部 返回列表