Next / Previous / Index / ITC Help System / Publications / Site map / NM Tech homepage

Making archive files in Linux

Tech Computer Center logo

The Linux tar utility is the preferred tool for building and extracting files from archives. The archives are referred to as “tarballs”.

To make a tarball, use this command:

tar -cvzf archname.tgz file...
where archname is an arbitrary name, and each file can be either an ordinary file or a directory. If a directory, all the files and directories under that directory are included in the tarball.

Be sure to use relative path names for the files. If you use an absolute path name, that absolute path may not exist on some other system.

Here's an example. Your current working directory has a file in it named wapiti, and two subdirectories named tawny and bactrian. This command would combine all the file and directories into a tarball archive named elk.tgz:

tar -cvzf elk.tgz tawny bactrian wapiti

For the procedures you will use to extract some or all files from a tarball, see `Extracting archive files in Linux'.

For complete instructions for the tar command, see the man page for tar.

Next: Extracting archive files in Linux
See also: File transfer: moving files to or from the TCC
Previous: File restore: Copying files from removable media in Linux
Site map
Index: Keyword index to help pages
Help: New Mexico Tech Information Technology and Communications: Help System
ITC Publications
To report a problem: File a ticket
Send mail to the User consultant on duty or call them at 575-835-5437
Home: About New Mexico Tech

John Shipman,
Last updated: 2008/01/21 06:52:55 UT
QR two-dimensional bar code