How to Easily Update a Tar File from Linux File Manager

Instead of recreating your tar archives when you need to add files, why not just add those files? Jack Wallen shows you how from the command line and a GUI file manager in Linux.

Image: Dilok Klaisataporn / Shutterstock

If you are a Linux administrator, chances are good that you will be using tar to create data backups or just create files from directories so that you can easily store them or share them with others. But how many times have you created a tar file, only to turn around and add a new file to the source directory? What are you doing then?

SEE: Over 40 Open Source & Linux Terms You Need To Know (TechRepublic Premium)

You recreated the tar file the same way you originally did. It’s a bit complicated, especially if you are working in an office environment. Why bother going through the same old process again to create a new tar file, when there is a much easier way to do it?

Before showing you this method, be aware that you can also achieve this via the command line. Let’s say you have TEST.tar and you want to add the mytest.txt file to the tar. To do this, you run the command:

tar -rf TEST.tar mytest.txt

If you then issue the command:

tar -tf TEST.tar

you will see that mytest.txt is in the archive.

Now how can we do this with a GUI? It’s very simple. You should know that this method does not only work with .tar files.

Instead, these files should be compressed and end with .gz, .xz, .zip, or .7z. So if you created your archive with a command like:

tar -cf TEST.tar.xz TEST

you should be OK.

Or, if you created the archive by right clicking on a directory in the file manager and selecting Compress, it will work.

To add the file to the archive, all you need to do is click on the mytest.txt file and drag it into the TEST.tar.xz archive. Once you’ve done that click to open the archive and you should see the mytext.txt file is there.

SEE: Linux Turns 30: Celebrating the Open Source Operating System (Free PDF) (TechRepublic)

Using this method allows you to add files to either compressed or uncompressed tar archives, while the command line option only allows you to add to an uncompressed archive. This simple task will save you time and, for once, give you options that the command line doesn’t.

Subscribe to TechRepublic How to make technology work on YouTube for all the latest technical advice for professionals at Jack Wallen’s business.

Also look

Source link

Donald E. Hollingsworth