New Linux administrators who are intimidated by the tarball file command line obviously haven't yet been introduced to File Roller. In this Daily Feature, Jack Wallen, Jr., explains how the File Roller GUI application simplifies the tar command line.
Typically when new-to-Linux administrators or users are confronted with a tar file, they shy away from the challenge. Add compression to the job at hand, and their trepidation turns into shrieks of terror.
Those newly initiated into the world of Linux need to remember that, for every daunting task they face, someone else has created a nifty GUI to make it as easy as 1-2-3. In this case, the File Roller application makes the task of archiving, un-archiving, and compressing Linux files wonderfully simple.
What is a tar file?
A tar file (or tarball) is a directory that contains various files that have been packed together into one file. For example: the directory IMAGES contains the files image1.jpg, image2.jpg, image3.jpg, image4.jpg, and list.txt. To archive this directory and to make its storage much easier, the tar utility will fold the files into the directory creating a single file, roughly the same size as the files and directory combined.
Once the directory has been tarr'd, it can be unpacked, which returns the directory to its original state. While in tar form, this file can also be compressed to shrink the size.
The standard syntax of archiving a directory (using the example above) would be tar -cf IMAGES.tar. To unpack the IMAGES.tar directory, the syntax is tar -xvf IMAGES.tar.
Of course tar can become much more complex than this simple example, which is where File Roller comes in handy.
Working with File Roller
The File Roller GUI is a part of the GNOME Desktop Environment and therefore behaves like any standard gtk GUI (see Figure A). There are drop-down menus, clickable buttons, view panes, and so on.
|The opening File Roller screen is empty.|
You have two options to start File Roller. The first, and easiest, is from the GNOME main menu (the foot menu). File Roller is found by navigating through Applications | Accessories. The second method of starting File Roller is to open a console window and enter the command file-roller. With either option, the initial File Roller window (see Figure A) will open and will be ready for action.
Creating an archive
Let's create an archive as outlined above, with the IMAGES directory containing four JPG files and one TXT file. The first step is to click on the New button in the main File Roller window. In the New Archive window, your first inclination might be to search the listing for the file name. Remember, however, this is a new archive so the name of the archive will be typed in the Selection text area (see Figure B).
|To create an uncompressed archive, either select the type from the File Type drop down box or enter the extension (.tar) after the file name.|
Click OK and then the File Roller title bar will read File Roller - IMAGES.tar. This means that the IMAGES archive is ready to have files placed inside.
To place files inside the new archive, click the Add button, select the next file to add, and click OK. After all the files are added, the IMAGES archive will look like Figure C.
|Add up the Size column to get a total of tarr'd file size.|
Now that the images are included in the file, the tar file has been created. There is no need to save. You're done. Not surprisingly, there are many more “tricks” that can be “played” on the archive. For instance, from the File drop-down menu, the new archive can be renamed, moved, copied, deleted, and the archive properties can be viewed. The one thing that you cannot do is compress archive once it has been created. If you know the archive will need to be compressed, select a compressed tar instead of an uncompressed version when you are creating the archive.
Unpacking an archive
Just as easily as archives can be packed with File Roller, they can be unpacked as well. From the main window, click the Open button, select the file to be unpacked, click OK, and then click Extract. The next window that opens, the Extract window (Figure D), will need a bit of information, such as the location of the directory to extract to, the number of files (or all files) to be extracted, and how directories are to be acted upon (re-created, over-written, and so on).
|By clicking Add To Favorites, commonly saved-to directories can be quickly accessed|
The default directory that File Roller extracts to is the user’s home directory. If OK is selected without specifying a target directory, all the files from the archive will be extracted to the default. This could be a disaster if there are a large number of files within the archive. In order to avoid this, first check the file hierarchy within the tar file to be unpacked. If, when you open up the tar file, there is a directory to navigate through (before you see any actual files), then that archive will unpack into its own directory. If there is no directory within the tar file, the contents of the tar file will explode into the current working directory.
If there is no directory within the tar file, I would suggest creating a directory to unpack the file into. To do this, open up a console window and run the command (as normal user) mkdir TARBALLS. With this directory in place, you can unpack the contents into it by clicking Browse (in the Extract window) and selecting the newly created directory. Once you select the proper directory, click OK and the files will be extracted and ready to work with.
A few extras
There are a couple of nice extras that File Roller has that can make your life a bit easier. One extra is the ability to view a file within a tar with the View button. This file viewing capability is limited to simple text files (such as INSTALL or README files) but can aid in the usage of the tarball.
From the Actions drop-down list, you can open files with a specified program by selecting Open Files With. This is helpful if the tarball documentation has been saved as an HTML document or if there are images to view.
One last helpful extra is the ability to view tarball file properties. With a tarball open in File Roller, select Archive Properties from the File drop-down menu. The Archive Properties window will reveal the files' path, the files’ full name, the file size, the number of files within the tarball, and the date and time.
So is it useful?
Having worked with tar files for a number of years, I am very at home with the tar command line, so I’m not necessarily the target user for the File Roller tool. Nonetheless, there is no question that this tool allows newer members of the Linux community to easily access and manipulate tar. The fact is that File Roller is one of the better tools I've seen for taking an often-complicated task and making it point-and-click simple.
So for any Linux newbie, File Roller should be your friend. You will inevitably have to deal with a tar file, so why not do it with grace—and a GUI?