All commands tested on Mac OS Monterey / Jul 02, 2024

How to append a file to an existing tar archive

Add new-file.txt to the existing archive files.tar.

You can use this short tar command.

              
                  tar -rvf files.tar new-file.txt
              
          

Or this more verbose tar command.

              
                  tar --append --verbose --file files.tar new-file.txt
              
          

If you need to add multiple files to an exsiting archive, simply chain the filenames.

tar -rvf files.tar new-file.txt another-file.txt yet-another-file.txt


Options explained

  1. -r or --append tells tar to append to an existing archive
  2. v or --verbosetells tar to produce verbose output
  3. f or --filetells tar that the next parameter will be the tar file to create, extract, append to, list, etc.

More commands for appending to tar archives