将单个文件添加到 TAR 中

Gab*_*qos 0 linux tar

我有一个名为 的 tar 存档backup.tar。我想将一个名为 的文件添加sshd.conf到此tar存档中。

小智 5

man tar

-r, --append
              Append files to the end of an archive.  Arguments have the same meaning as for -c (--create).
Run Code Online (Sandbox Code Playgroud)

所以,就你而言,

tar -rf backup.tar sshd.conf

应该能解决问题