在终端输入man tar 可以查看tar命令的用法:
SYNOPSIS
tar [OPTION...]
[FILE]...
DESCRIPTION
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.
........
-x, --extract,
--get
extract files from an archive
-C,
--directory=DIR
change to directory DIR
-f,
--file=ARCHIVE
use archive file or device ARCHIVE
-j,
--bzip2
filter the archive through
bzip2
-J,
--xz
filter the archive through xz
-v,
--verbose
verbosely list files processed
-z,
--gzip
filter the archive through gzip
等等。。。。
c:(create)建立新的备份文件;
v:(verbose)显示指令的执行过程;
f:(file)置顶备份文件;
z:(gzip或ungzip)通过gzip指令处理备份文件;
x:从备份文件中还原文件;
.tar文件
tar -xvf file.tar
.tar.gz文件
tar -zxvf file.tar.gz
.tar.bz2文件
tar -jxvf file.tar.bz2
.tar.xz文件
unxz file.tar.xz
每天学一点linux:tar命令,布布扣,bubuko.com
原文:http://www.cnblogs.com/ckings/p/3633361.html