tar Backup Examples

# backup the root and /usr file systems to a tape unit

tar cf /dev/rmt2 / /usr


# restore /usr from the above tape

tar xf /dev/rmt2 /usr


# backup a directory to a disk file so that it can be extracted anywhere
# Assume that the current working directory is /home.  The use of the
# dot notation means that whereever the files are extracted, they will
# go in the current directory.

tar chpf /backup/bozo ./bozo

# Now untar in another place, but keep the ownership as it was

tar --same-owner -xpf /backup/bozo