linux - 使用 tar 将 Linux 主目录的内容归档

标签 linux

我正在尝试使用 tar 归档我的主目录的内容,然后使用 gzip 压缩 tar 文件。我知道您可以使用 cat、tar 和 gzip 解压缩和解档 .tar.gz 文件。但是,我不知道如何压缩和存档。

最佳答案

嘿,这里有您的问题的链接。完整指南

https://www.howtogeek.com/248780/how-to-compress-and-extract-files-using-the-tar-command-on-linux/

tar -czvf name-of-archive.tar.gz /path/to/directory-or-file

这些开关的实际含义如下:

-c: Create an archive.
-z: Compress the archive with gzip.
-v: Display progress in the terminal while creating the archive, also known as “verbose” mode. The v is always optional in these commands, but it’s helpful.
-f: Allows you to specify the filename of the archive.

关于linux - 使用 tar 将 Linux 主目录的内容归档,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/49153719/

相关文章:

linux - IFS 变量是否发生以下变化?

mysql - 512 错误 UDF MySQL

linux - Jenkins Linux 从站输出

linux - 安装Centos 7时出现未知错误

Linux 上的 Android - 无法在我的 Android 设备上测试我的应用程序

c++ - stat 和 read() 的 cpp 文件读取错误

linux - makefile 不生成可执行文件

linux - 从 msgbox 覆盖 whiplash exitstatus

c - Linux和C,程序错误

python - 重定向 Python 解释器的 IO