tar - File archiver

Synopsis

tar -crtux[befmopvwHLPX] [archive] [blocksize] file ...

Description

The tar utility reads, writes, and lists files from an archive file.

Options

The following options select the function tar performs. One of these options must be specified.

-c
Create a new archive.
-r
Add the specified file to end of the achive.
-t
List the names of the files in the archive to standard output.
-u
Update the specified file in the archive if it has been modified since last written to the archive or add file to the archive if it is not in the archive.
-x
Extract the specified files from the archive. If no files are specified, all files are extracted from the archive.

The following options affect the operation of tar.

-b
Use the first operand (or the second, if f has already been specified) as the block size for the archive.
-e
Exit after the first error is found.
-f
Use the first operand (or the second, if b has already been specified) as the name of the archive instead of the default name. If the name of the file is -, tar writes to the standard output or reads from the standard input depending on the function.
-m
Do not restore the modification times. The modification time of the file is the time of extraction.
-o
Set the owner and group of extracted files to the user running tar instead of to the user and group saved with the archive.
-p
Preserve the owner, group, file mode, access time, and modification time of files extracted from the archive.
-v
Verbose mode. Write to standard error the name of each file being processed. When the t function is specified, the output also includes the mode, number of links, owner, group, size, and modification date of each file.
-w
Write the action to be taken, followed by the name of the file, and then wait for the user's confirmation. If an affirmative response is given, the action is performed. Any other input suppresses the action.
-H
Follow only command line symbolic links while performing a physical file system traversal.
-L
Follow all symbolic links to perform a logical file system traversal.
-P
Do not follow symbolic links, perform a physical file system traversal. This is the default mode.
-X
When traversing the file hierarchy specified by a path name, do not descend into directories that have a different device ID.

Operands

Each file is an object that is either added to the archive or extracted from the archive depending on the function.

Environment variables

tar is affected by the following environment variables:

QIBM_CCSID
The value of the environment variable is the CCSID used to create files extracted from the archive. There must be a valid translation from CCSID 819 to the specified CCSID.

Exit status

  • 0 when successful
  • >0 when unsuccessful