• Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • PrintPrint
Share this Page URL
Help

tar

tar

tar Creates, extracts, or appends to tape archives.
tar [-] <c | t | x | r | u>
								[fbemopvwzZhHLPX014578] [<archive>]
[<blocksize>] [-C <directory>] [-s <replstr>] <file1>
									<file2> ...

tar saves files to and restores files from a single file. Although that single file may have originally been intended to be magnetic tape, magnetic tape is not required.
One of the following flags is required:
-c Creates a new archive or overwrites an existing one.
-t Lists the contents of an archive. If any files are listed on the command line, only those files are listed.
-x Extracts files from an archive. If any files are listed on the command line, only those files are extracted. If more than one copy of a file exists in an archive, earlier copies are overwritten by later copies.
-r Appends the specified files to an archive. This only works on media on which an end-of-file mark can be overwritten.
-u Alias to -r.
In addition to the required flags, any of these options may be used:
-f <archive> Filename where the archive is stored. Default is /dev/rmt8.
-b <blocksize> Sets the blocksize to be used in the archive. Any multiple of 512 between 10240 and 32256 may be used.
-e Stops after the first error.
-m Does not preserve modification time.
-o Does not create directories.
-p Preserves user ID, group ID, file mode, and access and modification times.
-v Verbose mode.
-w Interactively renames files.
-z Compresses the archive using gzip.
-Z Compresses the archive using compress.
-h Follows symbolic links as if they were normal files or directories.
-H Follows symbolic links given on the command line only.
-L Follows all symbolic links.
-P Does not follow any symbolic links.
-X Does not cross mount points in the file system.
[-014578] Selects a backup device, /dev/rmtN.
-C <directory> Sets the working directory for the files. When extracting, files are extracted into the specified directory. When creating, specified files are matched from the directory.
-s <replstr> Modifies the file or archive member names specified by the pattern or file operands according to the substitution expression <replstr>, using the syntax of ed(1) in this format:
/old/new/[gp]

old is the old expression. new is the new expression.

The optional trailing g applies the substitution globally. That is, it continues to apply the substitution. The first unsuccessful substitution stops the g option.

The optional trailing p causes the final result of a successful substitution to be written to standard error in this format:

<original pathname> >> <new pathname>

Multiple -s <replstr> options can be specified. They are applied in the order listed.



PREVIEW

                                                                          

Not a subscriber?

Start A Free Trial


  
  • Creative Edge
  • Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • PrintPrint