Read and write tape archive files (UNIX)
Create a new archive:
tar -c [-b blksize] [-f file] [-vw] [filename...]
Write named files to the end of an archive:
tar -r -f file [-b blksize] [-vw] [filename...]
List all the files contained in an archive:
tar -t [-f file] [-v] [filename]
Extract named files from an archive:
tar -x [-f file] [-lmovw] [filename...]
- Specify the drive and density.
- Append tar files to an archive.
- Reblock as we read (for 4.2BSD pipes).
- -b blksize
- Specify the blocking factor for tape
records. The default is 1; the maximum is 20. This option should be used
only with raw magnetic tape archives. Normally, the block size is
determined automatically when reading tapes.
- Change to the directory dir.
- Create a new archive. Writing begins at the beginning of the archive,
instead of after the last file.
- Find the differences between the archive and the filesystem.
- Run the given script at the end of each tape (implies -M).
- -f file
- Specify the name of the archive to use
instead of the default, which is standard output.
If you specify the dash character (-) as a filename,
tar writes to the standard output or reads from the standard
input, whichever is appropriate for the options given.
Thus, you can use tar as the head or tail of a pipeline.
- Handle the old GNU-format incremental backup.
- Handle the new GNU-format incremental backup.
- Dump instead the files that symlinks point to.
- Ignore zeroed blocks in archive (means EOF).
- Begin at file name in the archive.
- Don't overwrite existing files when extracting.
- -L num
- Change tape after writing num * 1024 bytes.
- ("el") Report if all of the links to the files being
archived cannot be resolved. If this option isn't specified, no error
messages are written to the standard output. This option is valid only
with the -c and -r options.
- Create, list, or extract a multivolume archive.
- Don't restore modification times. The modification time of the file is
the time of extraction. This option is invalid with the
- Store only the files that are newer than date.
- ("Oh") Extract files to standard output.
- Write a V7 format archive.
- Don't strip leading slashes (/) from filenames.
- Extract all protection information.
- Show the block number within the archive with each message.
- Write named files to the end of the archive specified in the required
-f file option.
- Handle sparse files efficiently.
- Sort the names to extract to match archive.
- Get the names to extract or create from the file, name.
- List the names of all of the files in the archive.
- Unlink each file prior to extracting over it.
- Append only files that are newer than the copy in the archive.
- Create an archive with the volume name specified by name.
- Be verbose. Usually, tar works silently, but the
-v option causes it to print the name of each file
it processes, preceded by the option letter. With the -t
option, -v gives more information about the archive
entries than just the name.
- Attempt to verify the archive after writing it.
- Print the action to be taken, followed by the name of the file, then wait
for the user's confirmation. If you enter a word beginning with y,
the action is performed. Any other input means "no". This option is
invalid with the -t option.
- Exclude the globbing patterns listed in file.
- Extract named files from the archive. If a named file matches a directory
whose contents had been written onto the archive, that directory is
recursively extracted. If a named file in the archive doesn't exist on
the system, the file is created with the same mode as the one in the
archive, except that the set-user-id and set-group-id modes are set only
if you have appropriate privileges.
If the files exist, their modes are not changed except as described
above. The owner, group, and modification time are restored if possible.
If no filename argument is given, the entire
contents of the archive is extracted. Note that if several files with
the same name are in the archive, the last one overwrites all earlier
- Filter the archive through compress.
- Filter the archive through
- The pathname of the file to be archived.
The tar utility reads and writes archive files.
For more information, see the GNU website at
||This utility is subject to the GNU Public License (GPL).
We've included it for use on development systems.
The GNU tar is incompatible with the current
POSIX standard and with tar programs that follow
POSIX. For details, see the GNU documentation.
Display a verbose listing of the archive members in dist.tar:
tar -tvf dist.tar
Copy the contents of the current directory to the floppy drive:
tar -cf /dev/fd0 .
Make an archive, backup.tar, of all the C source and
header files in the current directory:
tar -cvf backup.tar *.[ch]
The controlling terminal (/dev/tty) is used to prompt
the user for information when either or both the -i or
-y options are specified.
Backing Up and Recovering Data
in the Neutrino User's Guide