| Previous | Table of Contents | Next |
Arguments
The following list describes the arguments that may be passed to the tar command.
| block | Specifies the blocking factor for raw devices. The default is set to 1. The possible block sizes range from 1 to 64. |
| device | The name of the device to be used for the archive. Each system usually has multiple device drivers for each physical media device. The following table lists some of the more popular drives. |
| D (Drive) | Description |
|---|---|
| /dev/rmt/0m | Raw magnetic tape, 1600 bpi. |
| /dev/rmt/0h | Raw magnetic tape, 6250 bpi. |
| /dev/mt/0m | Magnetic tape, 1600 bpi. |
| /dev/mt/0h | Magnetic tape, 6250 bpi. |
| /dev/mt/ctape | Cartridge tape. |
| /dev/ctape | Cartridge tape. |
| /dev/diskette | Floppy diskette. |
| The possible speeds for 9-track tapes are: | |
| S (Speed) | BPI (Bytes per inch) Rating |
| l | 800 BPI |
| m | 1600 BPI |
| h | 6250 BPI |
| Use these speed letters to replace the s in the ds option. | |
| BSD (Berkeley) | ||
|---|---|---|
| D (Drive) | Description | |
| /dev/rmt0 | Raw magnetic tape, the default drive. (rmt8) | |
| /dev/rmt8 | Raw magnetic tape, 6250 bpi, rewind. | |
| /dev/rmt12 | Raw magnetic tape, 6250 bpi, no rewind. | |
| /dev/rmt16 | Raw magnetic tape, 6250 bpi, rewind. | |
| /dev/rmt20 | Raw magnetic tape, 6250 bpi, no rewind. | |
| /dev/rst0 | Raw SCSI cartridge drive. Usually rst8. | |
| /dev/rst4 | Raw SCSI. QIC 02 format. | |
| /dev/rst8 | Raw SCSI. QIC 24 format. | |
| /dev/rct0 | Raw cartridge tape. | |
| /dev/rct4 | Raw QIC 02 cartridge tape. | |
| /dev/rct8 | Raw QIC 24 cartridge tape. | |
| filelist | The list of filenames and/or directories you wish to archive or unarchive (extract). |
EXAMPLES
Some examples of how to use tar follow.
cj> tar cf -C ./bin -C ../jim/bin /dev/rmt8
cj> cd fromdir cj> tar cf - . | ( cd todir; tar xf - )
cj> tar -cvf /dev/rmt/0m.
cj> tar -tvf /dev/rmt8 . rwxr-xr-x 901/100 1321 Aug 19 15:54:1989 ./ rwxr-xr-x 901/100 1321 Aug 19 15:54:1989 ./bin/ . . .
permissions uid/gid size date time file
cj> cd desired_directory cj> tar -xvf /dev/rmt/0m x ./file1, 199 bytes, 1 tape blocks . . .
cj> touch 11160101 .lastsave # set date back a few days Nov 11 1:00AM cj> find . -newer .lastsave -print | tar -rf arc - cj> touch .lastsave
DIAGNOSTICS AND BUGS
The tar command does have its shortcomings. The following list provides a brief description of those features that would be nice to have.
RELATED COMMANDS
Refer to the cpio command described in Module 25.
RELATED FILES
The tar command uses a temporary file to perform its processing.
| /tmp/tar* | The temporary work file tar uses to perform its task. |
APPLICATIONS
The most common use of tar is to create archive tapes and extract files when needed. The tar command is more sophisticated than the cpio program. It can update the existing archive file without having to rewrite the file from the beginning. It can also be used to copy directory structures from one directory to a new directory.
TYPICAL OPERATION
In this activity you use the tar command to archive a directory structure to a temporary file. If you can arrange to use the tape drive on your system, you might want to try this activity using the device name of your system's tape drive. But for simplicity we use a file on the system to archive your files. Begin at the shell prompt in your HOME directory.
| Previous | Table of Contents | Next |