Making Archive Files

On a MS Windows System

You need a suitable archiving application installed, e.g. 7-zip or WinZip. Use the graphical tool to select and add files to a new or existing archive file in an appropriate archive format, e.g. zip.

On an Ubuntu Linux System

Graphical Tools

Using the GNOME file browser

  1. Start the graphical file browser, e.g. from the Places Menu in the top panel select Home Folder
  2. In the file browser navigate to a folder containing the relevant files
  3. Select the files to include in the archive, e.g. click on a file and then hold down Ctrl and click on other files to select a specific set of files
  4. Right click on one of the selected files to reveal a menu and choose the option compress
  5. A dialog window will appear in which you can select the type of archive to create (tar.gz by default but you could choose zip etc) and the name and location of the archive file being created
  6. Click the create button and it will create the archive file containing the previously selected set of files

Using file roller

You can start the file roller with the command file-roller. The application has a button to create a new empty archive (which you then name) and buttons to open archives and add files and folders to the archive.

Command Line Tool

tar.gz

Tar can be used to combine a set of files into one single archive file and gzip (compress) that archive. For example suppose you wish to tar and compress the entire contents of a directory (called bar) and all its sub directories then you can do

tar -cvzf bar.tar.gz bar

The option c says to create a new archive, the v means we are in verbose mode (so we can see what it is doing), the z means to compress the tar file, and the f specifies the next thing will be the name of the tar archive. The final argument is the directory we wish to tar, it could have equally been a list of the files we wanted to put in the archive.

If you are given a tar.gz archive you can check its contents with

tar -tvzf bar.tar.gz

and you can then extract the contents with

tar -xvzf bar.tar.gz

(Note tarred and zipped archive sometimes have the extension .tgz rather than .tar.gz).

zip

A zip archive is often useful for transfering files from a UNIX/Linux system to a Windows PC where they can be extracted using WinZip or 7-zip etc. To zip up a list of files use a command of the form

zip archive-name.zip file1 file2 ......

To zip up the entire contents of a directory (called bar) and its sub directories do

zip -r bar.zip bar

For maximum compression instead do

zip -9r bar.zip bar

To list the contents of a zip file do

unzip -t bar.zip

To unzip a zipped file use unzip, e.g.

unzip foo.zip

Please contact us with feedback and comments about this page. Last updated on 22 Apr 2022 21:09.