If you’re a Linux administrator, you probably use tar to generate backups of data or to build files from directories so you may store or share them with others.
But how many times have you made a tar file only to add a new file to the source directory later?
So, what do you do now?
What is a TAR file?
A TAR file is a compressed archive made by tar, a Unix-based tool for backing up and distributing files. It comprises a number of files in an uncompressed format, as well as metadata about the archive. GNU Zip compression is widely used to compress TAR files into.GZ files.
The TAR file format was first used in 1979 with the tar software to write data to tape drives, which were data storage devices that read and wrote magnetic tape. The acronym TAR stands for “Tape Archive.”
The TAR format is commonly used in modern computing to combine many files into a single file on Unix and Linux platforms. Tarballs are particularly useful for backing up files or moving many files to a different location.
TAR files can also be compressed to make them smaller. GZ,.TAR.GZ, and.TGZ files can be created from TAR archives compressed with GNU Zip compression. Software installers are frequently packaged in compressed packages with the.tar.gz and.tgz file endings.
NOTE: TAR files are often referred to as “tarballs,” since they collect all types of files into one file, similar to a sticky tarball.
How to Easily Update a Tar File
You recreated the tar file in the same manner as before. That’s a pain, especially if you’re working on a desktop computer.
When there’s a far easier method to accomplish things, why bother rerunning the same old process for creating a fresh tar file?
Before we explain you how to use this method, keep in mind that you can also use the command line.
Let’s say you have TEST.tar and wish to include the file mytest.txt in it. To do so, type the following command:
tar -rf TEST.tar mytest.txt
If you then issue the command:
tar -tf TEST.tar
you’ll see that mytest.txt is found within the archive.
Now, how can we do this with a GUI? It’s very simple. You should know this method doesn’t work with just .tar files.
Instead, those files need to be compressed and end with either .gz, .xz, .zip, or .7z. So, if you’ve created your archive with a command like:
tar -cf TEST.tar.xz TEST
you should be OK.
This will also work if you compressed the archive by right-clicking a directory in the file manager and selecting Compress.
Simply right-click the mytest.txt file and drag it into the TEST.tar.xz archive to add it to the archive. After that, double-click the archive to open it, and you should see the mytext.txt file there.
You can attach files to compressed or uncompressed tar archives using this method, but the command line option only allows you to append to a non-compressed archive.
This easy job will save you time and, for the first time, provide you with options that the command line does not provide.
Click here to read more useful and interesting articles.