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 Auto Compression mode is enabled (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 if you save the buffer, the edited version will replace the version in the Tar buffer. Clicking with the mouse on the file name in the Tar buffer does likewise. v extracts a file into a buffer in View mode (see 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 within the archive. 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.
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
zoo archives, as well as
exe files that are
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 programs to unpack and repack archives. 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. Details of the program names and their options can be set in the ‘Archive’ Customize group.