23.12 File Archives
A file whose name ends in ‘.tar’ is normally an archive
made by the
tar program. Emacs views these files in a special
mode called Tar mode which provides a Dired-like list of the contents
(see Dired). You can move around through the list just as you
would in Dired, and visit the subfiles contained in the archive.
However, not all Dired commands are available in Tar mode.
If you enable Auto Compression mode (see Compressed Files), then
Tar mode is used also for compressed archives—files with extensions
The keys e, f and <RET> all extract a component file
into its own buffer. You can edit it there and when you save the buffer
the edited version will replace the version in the Tar buffer. v
extracts a file into a buffer in View mode. o extracts the file
and displays it in another window, so you could edit the file and
operate on the archive simultaneously. d marks a file for
deletion when you later use x, and u unmarks a file, as in
Dired. C copies a file from the archive to disk and R
renames a file. g reverts the buffer from the archive on disk.
The keys M, G, and O change the file's permission
bits, group, and owner, respectively.
If your display supports colors and the mouse, moving the mouse
pointer across a file name highlights that file name, indicating that
you can click on it. Clicking Mouse-2 on the highlighted file
name extracts the file into a buffer and displays that buffer.
Saving the Tar buffer writes a new version of the archive to disk with
the changes you made to the components.
You don't need the
tar program to use Tar mode—Emacs reads
the archives directly. However, accessing compressed archives
requires the appropriate uncompression program.
A separate but similar Archive mode is used for archives produced by
zoo, which have extensions corresponding to the program names.
The key bindings of Archive mode are similar to those in Tar mode,
with the addition of the m key which marks a file for subsequent
operations, and M-<DEL> which unmarks all the marked files.
Also, the a key toggles the display of detailed file
information, for those archive types where it won't fit in a single
line. Operations such as renaming a subfile, or changing its mode or
owner, are supported only for some of the archive formats.
Unlike Tar mode, Archive mode runs the archiving program to unpack
and repack archives. Details of the program names and their options
can be set in the ‘Archive’ Customize group. However, you don't
need these programs to look at the archive table of contents, only to
extract or manipulate the subfiles in the archive.