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.
       GNU `tar' saves many files together into a single tape or disk archive, and can restore individual files from the archive.

       Note  that  this manual page contains just very brief description (or more like a list of possible functionality) originally generated by the help2man utility.  The full documentation for tar is maintained as a Texinfo manual.  If the info and tar programs
       are properly installed at your site, the command `info tar' should give you access to the complete manual.

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.

DEFAULTS
       *This* tar installation defaults to:


Common options:
       -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

       -p, --preserve-permissions
              extract  information  about  file permissions (default for superuser)

       -v, --verbose
              verbosely list files processed

       -z, --gzip
              filter the archive through gzip

使用tar压缩文件
tar -zcvf 20200811.tar.gz ./dira/

该命令表示压缩当前文件夹下的文件夹test,压缩后缀名为test.tar.gz

如果不需要压缩成gz,只需要后缀为tar格式的,那么输入如下命令:
tar -cvf 20200811.tar ./dira/

使用tar解压文件
tar -xzvf aa.tar.gz

该命令表示把后缀为.tar.gz的文件解压到当前文件夹下。

如果压缩文件的后缀是.tar,没有gz,则使用命令:

tar -xvf aa.tar

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值