Stanford University School of Earth Science
 
Home
News
New Users
Policies
Network File Server
Web Server
Get Help
Net Connections
Your Macintosh
Your Windows PC
Your Unix/Linux System
Other School Resources
Using Unix
   Overview
   Documentation
   Accounts
   Using the Shell
   Using X-Windows
   File Manipulation
   Net Commands
   Editing Text
   Formatting Text
   Printing
   Filters & Utilities
   Programming

Extracting from a tar archive

Last revision July 20, 2004

Additional topics:

 

To extract or restore files from the tar archive, use the x operation. You should first change your working directory to the new directory where you want to put the files. However, if you specified absolute pathnames when making the archive (for example, tar cf /dev/rmt1h /home/sysop/username), then tar must restore the files to the same pathname and doesn't care what your current directory is.

After the x operation flag, you can give an optional list of files or directory trees to extract. The names in the list must exactly match the names as stored in the archive. For example, if you archived the current directory which contained the file example, it is recorded in the archive with the name ./example, and you must specify the name in that form to recover it. If you give no list of files to recover, all files in the archive are extracted.

Just like when you created archives, use the f option with extraction to specify the location of a tar archive on disk or on the non-standard tape drive, for example:

tar xf /tmp/myfiles.tar

If you specify the v option, tar will list the names of the files as it extracts them, for example:

tar xvf /tmp/myfiles.tar

 


Comments?

Stanford University    |