FileCompression
931
Comment:
|
5340
Added RAR workaround
|
Deletions are marked like this. | Additions are marked like this. |
Line 1: | Line 1: |
I'm going to discuss the simple way of handling the popular GNU Tar compression format (tar.gz) & the BZ2 format (.bz2) via the command line (terminal). | ## page was renamed from ArchivingAndUnarchiving Files can be compressed in a variety of formats. Some of these can be opened by Ubuntu automatically. Others can be handled if you install extra packages. |
Line 3: | Line 4: |
=== Uncompressing a GNU Tar archive === | ## This page needs to be rearranged alphabetically by type, rather than level of support. If I already knew the level of support, I probably wouldn't be reading in the first place. [[TableOfContents()]] == Basic Archives == [[Anchor(basic)]] Many archives ( [#tar .tar],[#targz .tar.gz],[#zip .zip] ) Can easily be opened simply by using Archive Manager. To open these formats, click on them with the right mouse button, and choose "Extract here". like this: [[BR]] attachment:extracthere.jpg |
Line 5: | Line 12: |
==== GNU Tar ==== | Double-clicking on them will open the Archive Manager for other tasks.[[BR]] attachment:archivemanager.jpg |
Line 7: | Line 15: |
Example: '''''file.tar.gz''''' | == Non-archive formats == These formats are not technically archives, but can be opened by Archive Manager: === Deb installer packages (.deb) === These are actually programs that need to be installed. Open a terminal and type {{{sudo dpkg -i DEBNAME.deb}}}. '''Warning: Installing programs from .debs can seriously damage your system.''' === CD Images (.iso) === These are images to be burned on to a cd. See ["BurningIsoHowto"] === Java Archives (.jar) === These are java programs. See ["Java"] === Firefox extensions (.xpi) === These are actually extensions for Mozilla Firefox. To install them, launch Firefox and choose Open File from the File menu. Choose the .xpi file and click ok. Firefox will then install the extension. '''Warning: Installing certain extensions may damage your Firefox profile''' == Archive formats == === 7zip (.7z) === 7zip is a new type of free archive format. Install the package {{{p7zip}}} from the Universe repository (AddingRepositoriesHowto). To open these files in [#basic Archive Manager] You need to tell Ubuntu how to deal with these files. Right-click on them and choose Properties. The 4th tab is Open With. Click on it and choose the Add button. Select the program {{{Archive Manager}}}. [[BR]] attachment:openwith.jpg After this, you can use these files normally from [#basic Archive manager] === Ace (.ace) === ACE archives are relatively uncommon and are extraced using the 'unace' utility To add support for it, install {{{unace}}} from the universe repository (AddingRepositoriesHowto). This cannot be used from [#basic Archive Manager] so must be used on the command line. To extract .ace files, run the following command: {{{ unace x file.ace }}} === Rar (.rar) === Rar is a non-free archive format created by Rarsoft. There are several versions of rar and the newest version, 3.0, is not supported by any free tools. To add support for it, install {{{unrar-nonfree}}} from the multiverse repository (AddingRepositoriesHowto). As of Hoary, if you don't have the rar package installed there is one more step to get unrar working in [#basic Archive Manager] (so you can double-click on RAR files to open them). You must create a symbolic link from rar to unrar: |
Line 10: | Line 62: |
tar -zxvf file.tar.gz | sudo ln -s /usr/bin/unrar /usr/bin/rar |
Line 13: | Line 65: |
There, you're done, you'll have a folder with the contents of the compressed file. | ==== Password protected .rar files ==== These Cannot be opened in the Archive Manager. |
Line 15: | Line 68: |
==== BZ2 ==== | To open a password protected Rar file, open the terminal and type {{{unrar -e RARFILENAME.rar}}}. It will then prompt you for the password. [[Anchor(tar)]] === GNU Tar (.tar) === The tar archive is an old archive format made for tapes which consist of files added to a single file, one after the other. These files can be extracted using the [#basic Archive Manager] === GNU Tar GZ (.tar.gz .tgz) === This archive is a [#tar tar] archive, which has then been zipped using 'gzip' which is an open source zip utility. These files can be extracted using [#basic Archive Manager] [[Anchor(tarbz2)]] === GNU Tar bzip2 (.tar.bz2) === This archive is a [#tar tar] archive, which has then been zipped using 'bzip2' which is an open source zip utility which results in smaller file sizes than [#targz gzip] however uses more processing power. These files can be extracted using the [#basic Archive Manager] [[Anchor(zip)]] === Zip (.zip) === This is an older archive (and compression) format that originates with PKZip developed by Phil Katz in 1989. It has been in use with DOS and windows for many years. These files can be extracted using the [#basic Package Manager] == Command Line Usage == Many of these utilities can be used on the command line, sometimes this is quicker or easier than using the [#basic Archive Manager] for example to extract a tar bz2 file |
Line 20: | Line 104: |
tar -jxvf file.tar.bz2 | tar jxvf file.tar.bz2 }}} This will show you what it extracts, and in most cases will be in a sub directory of {{{file}}} You can also make these files on the command line like so: {{{ tar jcvf file.tar.bz2 dir1 dir2 ... |
Line 23: | Line 114: |
=== Creating GNU Tar archive === | file.tar.bz2 is the name of the tar file we wish to create and dir1 dir2 are the names of the directories and/or files we wish to include in the tar.bz2 archive. |
Line 25: | Line 116: |
to use gzip, simply put {{{zxvf}}} or {{{zxvf}}} in place of the {{{jxvf}}} or {{{jcvf}}} in the command line to zip and unzip, simply run |
|
Line 26: | Line 120: |
tar -cvf file.tar dir1 dir2 ... | unzip file.zip }}} and {{{ zip file.zip dir1 dir1 ... |
Line 29: | Line 127: |
file.tar is the name of the tar file we wish to create and dir1 dir2 are the names of the directories and/or files we wish to include in the tar archive. We can then compress the archive using gzip or bzip2. Using gzip type {{{ gzip file.tar }}} This will create '''''file.tar.gz''''' Using bzip type {{{ bzip2 file.tar }}} This will create '''''file.tar.bz2''''' |
CategoryDocumentation |
Files can be compressed in a variety of formats. Some of these can be opened by Ubuntu automatically. Others can be handled if you install extra packages.
Basic Archives
- Many archives ( [#tar .tar],[#targz .tar.gz],[#zip .zip] ) Can easily be opened simply by using Archive Manager.
To open these formats, click on them with the right mouse button, and choose "Extract here". like this: BR attachment:extracthere.jpg
Double-clicking on them will open the Archive Manager for other tasks.BR attachment:archivemanager.jpg
Non-archive formats
These formats are not technically archives, but can be opened by Archive Manager:
Deb installer packages (.deb)
These are actually programs that need to be installed. Open a terminal and type sudo dpkg -i DEBNAME.deb. Warning: Installing programs from .debs can seriously damage your system.
CD Images (.iso)
These are images to be burned on to a cd. See ["BurningIsoHowto"]
Java Archives (.jar)
- These are java programs. See ["Java"]
Firefox extensions (.xpi)
These are actually extensions for Mozilla Firefox. To install them, launch Firefox and choose Open File from the File menu. Choose the .xpi file and click ok. Firefox will then install the extension. Warning: Installing certain extensions may damage your Firefox profile
Archive formats
7zip (.7z)
7zip is a new type of free archive format.
Install the package p7zip from the Universe repository (AddingRepositoriesHowto).
To open these files in [#basic Archive Manager] You need to tell Ubuntu how to deal with these files. Right-click on them and choose Properties. The 4th tab is Open With. Click on it and choose the Add button. Select the program Archive Manager. BR attachment:openwith.jpg
After this, you can use these files normally from [#basic Archive manager]
Ace (.ace)
ACE archives are relatively uncommon and are extraced using the 'unace' utility
To add support for it, install unace from the universe repository (AddingRepositoriesHowto).
This cannot be used from [#basic Archive Manager] so must be used on the command line. To extract .ace files, run the following command:
unace x file.ace
Rar (.rar)
Rar is a non-free archive format created by Rarsoft. There are several versions of rar and the newest version, 3.0, is not supported by any free tools.
To add support for it, install unrar-nonfree from the multiverse repository (AddingRepositoriesHowto).
As of Hoary, if you don't have the rar package installed there is one more step to get unrar working in [#basic Archive Manager] (so you can double-click on RAR files to open them). You must create a symbolic link from rar to unrar:
sudo ln -s /usr/bin/unrar /usr/bin/rar
Password protected .rar files
These Cannot be opened in the Archive Manager.
To open a password protected Rar file, open the terminal and type unrar -e RARFILENAME.rar. It will then prompt you for the password.
GNU Tar (.tar)
The tar archive is an old archive format made for tapes which consist of files added to a single file, one after the other.
These files can be extracted using the [#basic Archive Manager]
GNU Tar GZ (.tar.gz .tgz)
This archive is a [#tar tar] archive, which has then been zipped using 'gzip' which is an open source zip utility.
These files can be extracted using [#basic Archive Manager] Anchor(tarbz2)
GNU Tar bzip2 (.tar.bz2)
This archive is a [#tar tar] archive, which has then been zipped using 'bzip2' which is an open source zip utility which results in smaller file sizes than [#targz gzip] however uses more processing power.
These files can be extracted using the [#basic Archive Manager] Anchor(zip)
Zip (.zip)
This is an older archive (and compression) format that originates with PKZip developed by Phil Katz in 1989. It has been in use with DOS and windows for many years.
These files can be extracted using the [#basic Package Manager]
Command Line Usage
Many of these utilities can be used on the command line, sometimes this is quicker or easier than using the [#basic Archive Manager]
for example to extract a tar bz2 file
Example: file.tar.bz2
tar jxvf file.tar.bz2
This will show you what it extracts, and in most cases will be in a sub directory of file
You can also make these files on the command line like so:
tar jcvf file.tar.bz2 dir1 dir2 ...
file.tar.bz2 is the name of the tar file we wish to create and dir1 dir2 are the names of the directories and/or files we wish to include in the tar.bz2 archive.
to use gzip, simply put zxvf or zxvf in place of the jxvf or jcvf in the command line
to zip and unzip, simply run
unzip file.zip
and
zip file.zip dir1 dir1 ...
FileCompression (last edited 2008-08-06 16:36:58 by localhost)