个人工具

“UbuntuHelp:FileCompression”的版本间的差异

来自Ubuntu中文

跳转至: 导航, 搜索
第8行: 第8行:
 
* Right click an archive and select "Extract Here" to extract the files into the '''''current working directory'''''.
 
* Right click an archive and select "Extract Here" to extract the files into the '''''current working directory'''''.
 
* For more fine grained control choose 'Open with "Archive Manager" ' from the popup menu. <<BR>>
 
* For more fine grained control choose 'Open with "Archive Manager" ' from the popup menu. <<BR>>
{{https://help.ubuntu.com/community/FileCompression?action=AttachFile&do=get&target=extracthere.png%7D%7D
+
https://help.ubuntu.com/community/FileCompression?action=AttachFile&do=get&target=extracthere.png
 
* Double clicking on an archive will open it with Archive Manager. This achieves the same thing as right clicking the archive and selecting 'Open with "Archive Manager" '.<<BR>>
 
* Double clicking on an archive will open it with Archive Manager. This achieves the same thing as right clicking the archive and selecting 'Open with "Archive Manager" '.<<BR>>
{{https://help.ubuntu.com/community/FileCompression?action=AttachFile&do=get&target=archivemanager2.png%7D%7D
+
https://help.ubuntu.com/community/FileCompression?action=AttachFile&do=get&target=archivemanager2.png
 
For more complete information on supported formats and usage please see [[UbuntuHelp:ArchiveManager|Archive Manager]].
 
For more complete information on supported formats and usage please see [[UbuntuHelp:ArchiveManager|Archive Manager]].
 
=== Non-archive formats ===
 
=== Non-archive formats ===
 
{|border="1" cellspacing="0"
 
{|border="1" cellspacing="0"
|{{https://help.ubuntu.com/community/IconsPage?action=AttachFile&do=get&target=info.png%7D%7D Archive Manager can open some formats that are not technically considered as archives.
+
|https://help.ubuntu.com/community/IconsPage?action=AttachFile&do=get&target=info.png Archive Manager can open some formats that are not technically considered as archives.
 
|}
 
|}
 
==== Debian installer packages (.deb) ====
 
==== Debian installer packages (.deb) ====
 
* DEB files are actually programs that need to be installed.  
 
* DEB files are actually programs that need to be installed.  
 
* If you are using Ubuntu 6.06 Dapper Drake or higher, you can double click ''.deb'' files to install them.  You can also right click and select 'Open with [[UbuntuHelp:GDebi|GDebi]] Package Installer" '.
 
* If you are using Ubuntu 6.06 Dapper Drake or higher, you can double click ''.deb'' files to install them.  You can also right click and select 'Open with [[UbuntuHelp:GDebi|GDebi]] Package Installer" '.
* {{https://help.ubuntu.com/community/IconsPage?action=AttachFile&do=get&target=terminal.png%7D%7D [[UbuntuHelp:UsingTheTerminal|Command line installation]]
+
* https://help.ubuntu.com/community/IconsPage?action=AttachFile&do=get&target=terminal.png [[UbuntuHelp:UsingTheTerminal|Command line installation]]
 
<ol><li>Open a terminal.
 
<ol><li>Open a terminal.
 
</li><li>Navigate to the directory containing the ''.deb'' file.
 
</li><li>Navigate to the directory containing the ''.deb'' file.
第27行: 第27行:
 
sudo dpkg -i <filename.deb></nowiki></pre>  
 
sudo dpkg -i <filename.deb></nowiki></pre>  
 
{|border="1" cellspacing="0"
 
{|border="1" cellspacing="0"
| {{https://help.ubuntu.com/community/IconsPage?action=AttachFile&do=get&target=warning.png%7D%7D Installing programs from untrustworthy sources can seriously damage your system. Manually installing programs may also cause dependency problems.
+
| https://help.ubuntu.com/community/IconsPage?action=AttachFile&do=get&target=warning.png Installing programs from untrustworthy sources can seriously damage your system. Manually installing programs may also cause dependency problems.
 
|}
 
|}
 
==== CD Images (.iso) ====
 
==== CD Images (.iso) ====
* ISO images are images to be burned on to a CD. See [[UbuntuHelp:BurningIsoHowto]] for further information on burning an ''.iso'' file.
+
* ISO images are images to be burned on to a CD. See [[UbuntuHelp:BurningIsoHowto|BurningIsoHowto]] for further information on burning an ''.iso'' file.
 
* ISO images can also be mounted. See [[UbuntuHelp:MountIso|MountIso]] for more information.
 
* ISO images can also be mounted. See [[UbuntuHelp:MountIso|MountIso]] for more information.
 
==== Java Archives (.jar) ====
 
==== Java Archives (.jar) ====
* JAR files are java programs. See [[UbuntuHelp:Java]].
+
* JAR files are java programs. See [[UbuntuHelp:Java|Java]].
 
==== Firefox extensions (.xpi) ====
 
==== Firefox extensions (.xpi) ====
 
* XPI files are extensions for Mozilla Firefox.  
 
* XPI files are extensions for Mozilla Firefox.  
第40行: 第40行:
  
 
{|border="1" cellspacing="0"
 
{|border="1" cellspacing="0"
| {{https://help.ubuntu.com/community/IconsPage?action=AttachFile&do=get&target=warning.png%7D%7D Installing certain extensions may damage your Firefox profile.
+
| https://help.ubuntu.com/community/IconsPage?action=AttachFile&do=get&target=warning.png Installing certain extensions may damage your Firefox profile.
 
|}
 
|}
 
=== Archive formats ===
 
=== Archive formats ===
第49行: 第49行:
 
* This uncommon format is extracted using the 'unace' utility.  Install <code><nowiki>unace</nowiki></code> from the [[UbuntuHelp:AddingRepositoriesHowto|Universe repository]].
 
* This uncommon format is extracted using the 'unace' utility.  Install <code><nowiki>unace</nowiki></code> from the [[UbuntuHelp:AddingRepositoriesHowto|Universe repository]].
 
* ACE archives are not supported by Archive Manager. You must open then from the command line.
 
* ACE archives are not supported by Archive Manager. You must open then from the command line.
{{https://help.ubuntu.com/community/IconsPage?action=AttachFile&do=get&target=terminal.png%7D%7D <pre><nowiki>
+
https://help.ubuntu.com/community/IconsPage?action=AttachFile&do=get&target=terminal.png <pre><nowiki>
 
unace x <filename>.ace
 
unace x <filename>.ace
 
</nowiki></pre>
 
</nowiki></pre>
第74行: 第74行:
 
* Tar BZ2 archives are bzip2 compressed ''.tar'' archives.
 
* Tar BZ2 archives are bzip2 compressed ''.tar'' archives.
 
{|border="1" cellspacing="0"
 
{|border="1" cellspacing="0"
|{{https://help.ubuntu.com/community/IconsPage?action=AttachFile&do=get&target=IconHint2.png%7D%7D Bzip2 compressed archives are smaller than gzip archives. The trade off is that bzip compression requires more processing power than gzip compression.  
+
|https://help.ubuntu.com/community/IconsPage?action=AttachFile&do=get&target=IconHint2.png Bzip2 compressed archives are smaller than gzip archives. The trade off is that bzip compression requires more processing power than gzip compression.  
 
|}
 
|}
 
* Tar BZ2 archives can be extracted with Archive Manager.
 
* Tar BZ2 archives can be extracted with Archive Manager.
第82行: 第82行:
 
* ZIP files can be extracted with Archive Manager.
 
* ZIP files can be extracted with Archive Manager.
 
=== Command Line Usage ===
 
=== Command Line Usage ===
* {{https://help.ubuntu.com/community/IconsPage?action=AttachFile&do=get&target=terminal.png%7D%7D Many of the above utilities can be used quickly and efficiently from the command line. This section will briefly cover common command line usage for these utilities. Replace <filename> with the name of your file.
+
* https://help.ubuntu.com/community/IconsPage?action=AttachFile&do=get&target=terminal.png Many of the above utilities can be used quickly and efficiently from the command line. This section will briefly cover common command line usage for these utilities. Replace <filename> with the name of your file.
 
* In most cases you can replace the filename with the complete path to the file.
 
* In most cases you can replace the filename with the complete path to the file.
 
{|border="1" cellspacing="0"
 
{|border="1" cellspacing="0"
|{{https://help.ubuntu.com/community/IconsPage?action=AttachFile&do=get&target=IconHint2.png%7D%7D Using a full path is useful when scripting.
+
|https://help.ubuntu.com/community/IconsPage?action=AttachFile&do=get&target=IconHint2.png Using a full path is useful when scripting.
 
|}
 
|}
{{https://help.ubuntu.com/community/IconsPage?action=AttachFile&do=get&target=example.png%7D%7D <pre><nowiki>
+
https://help.ubuntu.com/community/IconsPage?action=AttachFile&do=get&target=example.png <pre><nowiki>
 
   tar -czpf /home/me/somefile.tar.gz /path/to/files/to/be/archived</nowiki></pre>
 
   tar -czpf /home/me/somefile.tar.gz /path/to/files/to/be/archived</nowiki></pre>
 
==== Extracting a tar.bz2 file ====
 
==== Extracting a tar.bz2 file ====

2008年10月19日 (日) 22:49的版本

Parent: AccessoriesApplications

File compression

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 can easily be opened using Archive Manager.
  • Right click an archive and select "Extract Here" to extract the files into the current working directory.
  • For more fine grained control choose 'Open with "Archive Manager" ' from the popup menu. <
    >

FileCompression?action=AttachFile&do=get&target=extracthere.png

  • Double clicking on an archive will open it with Archive Manager. This achieves the same thing as right clicking the archive and selecting 'Open with "Archive Manager" '.<
    >

FileCompression?action=AttachFile&do=get&target=archivemanager2.png For more complete information on supported formats and usage please see Archive Manager.

Non-archive formats

IconsPage?action=AttachFile&do=get&target=info.png Archive Manager can open some formats that are not technically considered as archives.

Debian installer packages (.deb)

  • DEB files are actually programs that need to be installed.
  • If you are using Ubuntu 6.06 Dapper Drake or higher, you can double click .deb files to install them. You can also right click and select 'Open with GDebi Package Installer" '.
  • IconsPage?action=AttachFile&do=get&target=terminal.png Command line installation
  1. Open a terminal.
  2. Navigate to the directory containing the .deb file.
  3. Enter this command. Replace <filename.deb> with the name of the actual file you are installing.
sudo dpkg -i <filename.deb>
IconsPage?action=AttachFile&do=get&target=warning.png Installing programs from untrustworthy sources can seriously damage your system. Manually installing programs may also cause dependency problems.

CD Images (.iso)

  • ISO images are images to be burned on to a CD. See BurningIsoHowto for further information on burning an .iso file.
  • ISO images can also be mounted. See MountIso for more information.

Java Archives (.jar)

  • JAR files are java programs. See Java.

Firefox extensions (.xpi)

  • XPI files are extensions for Mozilla Firefox.
  1. Launch Firefox and select File -> Open File.
  2. Select the .xpi file and press the "Open" button. Firefox will then install the extension.
IconsPage?action=AttachFile&do=get&target=warning.png Installing certain extensions may damage your Firefox profile.

Archive formats

7zip (.7z)

Archive Manager supports the 7zip compression format.

  • Install the package p7zip from the Universe repository. After installation of the package, Archive manager will handle 7z archives seamlessly.

Ace (.ace)

  • This uncommon format is extracted using the 'unace' utility. Install unace from the Universe repository.
  • ACE archives are not supported by Archive Manager. You must open then from the command line.
IconsPage?action=AttachFile&do=get&target=terminal.png
unace x <filename>.ace
  • If you encounter error messages, the file you are trying to decompress is too new for version of unace in repositories. Go to the developer's site and download "Unace for Linux". Extract the unace binary from the archive and replace your current version of unace.
sudo mv /location/of/new/unace /usr/local/bin/unace

Rar (.rar)

  • Rar is a non-free archive format created by Rarsoft. Version 3.0 is not supported by any free tools.
  • The free program unrar-free, supports rar up to Version 2.
  • Package unrar-free is available in the Universe repository.
  • To add support for rar version 3, install the unrar package from the Multiverse repository.
Multi-volume .rar archives
  • To extract the contents of a multi-volume .rar archive, extract the first file in the archive. Usually the extension will be .rar, .r00, or .r01.

GNU Tar (.tar)

  • The .tar archive is an old archive format made for tapes. TAR archives consist of files that are sequentially added to a single file.
  • TAR archives can be extracted using Archive Manager.
  • TAR archives can also be extracted from the command line. See man tar for more information on command line usage.

GNU Tar GZ (.tar.gz .tgz)

  • A Tar GZ archive is a gzip compressed .tar archive.
  • Tar GZ archives can be extracted with Archive Manager.
  • Tar GZ archives can also be extracted from the command line. See man tar for more information on command line usage.

GNU Tar bzip2 (.tar.bz2)

  • Tar BZ2 archives are bzip2 compressed .tar archives.
IconsPage?action=AttachFile&do=get&target=IconHint2.png Bzip2 compressed archives are smaller than gzip archives. The trade off is that bzip compression requires more processing power than gzip compression.
  • Tar BZ2 archives can be extracted with Archive Manager.
  • Tar BZ2 archives can also be extracted from the command line. See man tar for more information on command line usage.

Zip (.zip)

  • This is an older archive and compression format that originates with PKZip. It was developed by Phil Katz in 1989.
  • ZIP files can be extracted with Archive Manager.

Command Line Usage

  • IconsPage?action=AttachFile&do=get&target=terminal.png Many of the above utilities can be used quickly and efficiently from the command line. This section will briefly cover common command line usage for these utilities. Replace <filename> with the name of your file.
  • In most cases you can replace the filename with the complete path to the file.
IconsPage?action=AttachFile&do=get&target=IconHint2.png Using a full path is useful when scripting.
IconsPage?action=AttachFile&do=get&target=example.png
  tar -czpf /home/me/somefile.tar.gz /path/to/files/to/be/archived

Extracting a tar.bz2 file

  • Extract <filename>tar.bz2

tar jxvf <filename>.tar.bz2

  • This will show you what it extracts, and in most cases will create a directory named <filename>.
  • To extract a tar.gz, simply put z in place of j in the command line. For more information please refer to man tar.

Creating a tar.bz2 file

tar jcvf <filename>.tar.bz2 dir1 dir2 file1 file2 ...

  • <filename>.tar.bz2 is the name of the tar file we wish to create. dir# and file# are the names of the directories or files we wish to include in the tar.bz2 archive.
  • To use gzip compression instead of bz2, simply put z in place of j in the command line.

For more information please refer to man tar.

Rar

  • Rar v3.0 archives require the use of unrar.
unrar-free
  • Extract <filename>.rar

unrar-free <filename>.rar

  • If extracting fails with a message like the following, try the non-free version.
Extracting  file1.ext Failed
Extracting  file2.ext Failed
2 Failed
unrar-nonfree
  • Extract <filename>.rar

unrar x <filename>.rar

zip and unzip

  • To create a zip file containing dir1, dir2, ... :
zip <filename>.zip dir1 dir1 ...
  • To extract <filename>.zip:
unzip <filename>.zip