Jump to content United States-English
HP.com Home Products and Services Support and Drivers Solutions How to Buy
» Contact HP
More options
HP.com home
HP-UX System Administrator's Guide: Routine Management Tasks: HP-UX 11i Version 3 > Chapter 3 Managing Systems

Backing Up and Recovering Directories: Quick Reference for tar


Technical documentation

Complete book in PDF
» Feedback
Content starts here

 » Table of Contents

 » Index

The following examples may be useful for users wanting to make a quick backup to tape or disk. For information on system backup, see “Backing Up Data”.

  • To create a tar backup to tape:

    tar cv /home/me/mystuff /work/project5/mystuff

    This can include files and directories.

    NOTE: This overwrites anything already on the tape.
    • v (verbose) is optional throughout.

    • tar assumes the system default tape device file /dev/rmt/0m; this is implicit in all the tape examples that follow. You can specify a different device file (or a disk file; see the next example) by means of the f option.

  • To add files to the tape only if they are not already there, or have been modified since they were last written to the tape:

    tar uv /home/me

    New and changed files in the directory /home/me are added to the end of the tape (old versions of the files are not overwritten on the tape).

  • To find out what’s already on the tape:

    tar tv

  • To write out the tape table of contents to a file:

    tar tv > /home/me/backup.12.26.2007

  • To print out the tape table of contents:

    tar tv | lp lp_options  

  • To extract a file (get it back off the tape):

    tar x /users/me/mystuff/needed

  • To extract a directory (and any of its sub-directories)

    tar x /users/me/mystuff

  • To restore all the files on the tape (write them back to disk):

    tar x

    NOTE: tar recreates the directories on the tape if they aren’t already on the system.
Printable version
Privacy statement Using this site means you accept its terms Feedback to webmaster
© 2008 Hewlett-Packard Development Company, L.P.