Ztm0929留言 | 贡献
创建页面,内容为“GNU Tar provides the ability to create tar archives, as well as various other kinds of manipulation. For example, you can use Tar on previously created archives to extract files, to store additional files, or to update or list files which were already stored. Initially, tar archives were used to store files conveniently on magnetic tape. The name "Tar" comes from this use; it stands for ''t''ape ''ar''chiver. Despite the utility's name, Tar can direct its outp…”
 
Ztm0929留言 | 贡献
无编辑摘要
第3行: 第3行:
Initially, tar archives were used to store files conveniently on magnetic tape. The name "Tar" comes from this use; it stands for ''t''ape ''ar''chiver. Despite the utility's name, Tar can direct its output to available devices, files, or other programs (using pipes), it can even access remote devices or files (as archives).<ref>[https://www.gnu.org/software/tar/ Tar - GNU Project - Free Software Foundation]</ref>
Initially, tar archives were used to store files conveniently on magnetic tape. The name "Tar" comes from this use; it stands for ''t''ape ''ar''chiver. Despite the utility's name, Tar can direct its output to available devices, files, or other programs (using pipes), it can even access remote devices or files (as archives).<ref>[https://www.gnu.org/software/tar/ Tar - GNU Project - Free Software Foundation]</ref>


{{联系天明}}
== 常用选项 ==
 
* <code>-c</code>:创建一个新的归档文件。(取自于单词 Create)
* <code>-x</code>:从归档文件中提取文件。(取自于单词 Extract)
* <code>-v</code>:显示处理过程中的详细信息。(取自于单词 Verbose)
* <code>-f</code>:指定归档文件的名称。(取自于单词 File)
* <code>-z</code>:通过 [[gzip]] 压缩归档文件。
 
== 使用示例 ==
<syntaxhighlight lang="bash">
# 解压当前目录下 mediawiki-1.43.0.tar.gz 中的所有文件
# 生成一个名为 mediawiki-1.43.0 的目录
tar -xvzf mediawiki-1.43.0.tar.gz
</syntaxhighlight><syntaxhighlight lang="bash">
# 将 /var/www/wiki 整个文件夹压缩归档
# 并命名为 mediawiki-backup.tar.gz
tar -cvzf mediawiki-backup.tar.gz /var/www/wiki
</syntaxhighlight>{{联系天明}}


== 参考资料 ==
== 参考资料 ==
<references />
<references />

2024年12月29日 (日) 22:35的版本

GNU Tar provides the ability to create tar archives, as well as various other kinds of manipulation. For example, you can use Tar on previously created archives to extract files, to store additional files, or to update or list files which were already stored.

Initially, tar archives were used to store files conveniently on magnetic tape. The name "Tar" comes from this use; it stands for tape archiver. Despite the utility's name, Tar can direct its output to available devices, files, or other programs (using pipes), it can even access remote devices or files (as archives).[1]

常用选项

  • -c:创建一个新的归档文件。(取自于单词 Create)
  • -x:从归档文件中提取文件。(取自于单词 Extract)
  • -v:显示处理过程中的详细信息。(取自于单词 Verbose)
  • -f:指定归档文件的名称。(取自于单词 File)
  • -z:通过 gzip 压缩归档文件。

使用示例

# 解压当前目录下 mediawiki-1.43.0.tar.gz 中的所有文件
# 生成一个名为 mediawiki-1.43.0 的目录
tar -xvzf mediawiki-1.43.0.tar.gz
# 将 /var/www/wiki 整个文件夹压缩归档
# 并命名为 mediawiki-backup.tar.gz
tar -cvzf mediawiki-backup.tar.gz /var/www/wiki

== 如有内容修改建议,请联系天明 ==

参考资料