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

Extracting the contents of a tar archive

Tech Computer Center logo

If you would like to extract all the files from a ``tarball'' (tar archive) file, made with a relative pathname, and with file compression turned on (as recommended in our procedure for building tarballs), use this procedure.

  1. If you are not sure what is in the tarball, you can list its contents.
  2. Use the cd command to change your current working directory to the parent directory under which you want to place the extracted files. For example, if you want the extracted directory subtree to live inside directory /usr/meteor/data, you would use the command:
            cd /usr/meteor/data
  3. Move or copy the tarball file to that directory using the Unix mv, cp, or sftp commands.
  4. Extract the subtree using this command:
            tar -xvzf filename
    For example, if you have a tarball file named rainpics.tgz, you would use this command to extract its contents:
            tar -xvzf rainpics.tgz

After this procedure, the tarball will remain where you have placed it, and all the files within it will reside in or below the directory to which you extracted it.

In the example, if the rainpics.tgz tarball was made with relative pathname pics, the example command would put all of the extracted files at path /usr/meteor/data/pics and its subdirectories if any.

See also: How to move an entire directory tree
Previous: Listing the contents of a tar archive
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: 2006/12/19 01:13:48 UT
QR two-dimensional bar code