Linux下的tar压缩解压缩命令详解

tar -xZvf file.tar.Z   //解压tar.Z

unrar e file.rar //解压rar

unzip file.zip //解压zip

总结

1、*.tar 用 tar -xvf 解压

2、*.gz 用 gzip -d或者gunzip 解压

3、*.tar.gz和*.tgz 用 tar -xzf 解压

4、*.bz2 用 bzip2 -d或者用bunzip2 解压

5、*.tar.bz2用tar -xjf 解压

6、*.Z 用 uncompress 解压

7、*.tar.Z 用tar -xZf 解压

8、*.rar 用 unrar e解压

9、*.zip 用 unzip 解压

解压jdk到指定文件夹:

tar -xzvf jdk-8u131-linux-x64.tar.gz -C /usr/local/java

root@ubuntu:~# tar --help

用法: tar [选项…] [FILE]…

GNU ‘tar’ saves many files together into a single tape or disk archive, and can

restore individual files from the archive.

Examples:

tar -cf archive.tar foo bar # Create archive.tar from files foo and bar.

tar -tvf archive.tar # List all files in archive.tar verbosely.

tar -xf archive.tar # Extract all files from archive.tar.

主操作模式:

-A, --catenate, --concatenate 追加 tar 文件至归档

-c, --create 创建一个新归档

-d, --diff, --compare 找出归档和文件系统的差异

–delete 从归档(非磁带!)中删除

-r, --append 追加文件至归档结尾

-t, --list 列出归档内容

–test-label 测试归档卷标并退出

-u, --update 仅追加比归档中副本更新的文件

-x, --extract, --get 从归档中解出文件

操作修饰符:

–check-device 当创建增量归档时检查设备号(默认)

-g, --listed-incremental=FILE 处理新式的 GNU 格式的增量备份

-G, --incremental 处理老式的 GNU 格式的增量备份

–ignore-failed-read

当遇上不可读文件时不要以非零值退出

–level=NUMBER 所创建的增量列表归档的输出级别

-n, --seek 归档可检索

–no-check-device 当创建增量归档时不要检查设备号

–no-seek 归档不可检索

–occurrence[=NUMBER] 仅处理归档中每个文件的第 NUMBER

个事件;仅当与以下子命令 --delete,

–diff, --extract 或是 --list

中的一个联合使用时,此选项才有效。而且不管文件列表是以命令行形式给出或是通过

-T 选项指定的;NUMBER 值默认为 1

–sparse-version=MAJOR[.MINOR]

设置所用的离散格式版本(隐含

–sparse)

-S, --sparse 高效处理离散文件

重写控制:

-k, --keep-old-files don’t replace existing files when extracting,

treat

  • 29
    点赞
  • 9
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值