【Linux】tar 命令

来源:互联网 发布:ecowater净水器知乎 编辑:程序博客网 时间:2024/05/17 03:25


  • 1 options
    • 1.1 -f
    • 1.2 -v
    • 1.3 -t
    • 1.4 -x
    • 1.5 -r
    • 1.6 -A
  • 2 解压指定文件

1 options

1.1 -f

–file = archive-name
-f archive-name
this option determines the name of the archive file that tar will work on.
指定要操作的tar文件

1.2 -v

-verbose
-v
shows details about the results of running tar. This can be especially useful
when the results might not be obvious.
显示tar运行的过程。为用户展现工作过程避免用户错误终止该程序。

1.3 -t

–list
-t
显示archive file中的文件
tar -tf vf.tar
tar -tvf vf.tar 显示详细信息(ls -l)

1.4 -x

–extract
-x
uncompress 解压缩。
tar -xvf vf.tar

1.5 -r

–append
-r
向archive file中添加文件
tar -rf vf.tar exp.cpp %将exp.cpp添加到vf.tar中

1.6 -A

–concatenate
-A
将一个tar文件内容复制到另一个压缩文件中去。
tar -Af vf.tar a.tar %将a.tar中内容拷贝到vf.tar中

2 解压指定文件

tar -xvf vf.tar vf %其中vf是vf.tar中的一个文件夹
tar -xvf vf.tar vf.cpp %其中vf.cpp是vf.tar中的一个文件
tar -xvf vf.tar vf/vf/Debug %只解压vf/vf/Debug

Author: visayafan <visayafan@gmail.com>

Date: 2011-11-26 16:37:01

HTML generated by org-mode 6.33x in emacs 23

原创粉丝点击