Home Explore Blog CI



man-pages

5th chunk of `tar.man`
edb2fee50c488ef5b23395371bfdbb6514d4960d6ab3004f0000000100000fa9
 Preserve metadata of existing directories.

       --one-top-level[=DIR]
              Extract all files into DIR, or, if used without argument, into a subdirectory named by the base name of the archive (minus standard compression suffixes recognizable by --auto-compress).

       --overwrite
              Overwrite existing files when extracting.

       --overwrite-dir
              Overwrite metadata of existing directories when extracting (default).

       --recursive-unlink
              Recursively remove all files in the directory prior to extracting it.

       --remove-files
              Remove files from disk after adding them to the archive.

       --skip-old-files
              Don’t replace existing files when extracting, silently skip over them.

       -U, --unlink-first
              Remove each file prior to extracting over it.

       -W, --verify
              Verify the archive after writing it.

   Output stream selection
       --ignore-command-error

       Ignore subprocess exit codes.

       --no-ignore-command-error
              Treat non‐zero exit codes of children as error (default).

       -O, --to-stdout
              Extract files to standard output.

       --to-command=COMMAND
              Pipe  extracted files to COMMAND.  The argument is the pathname of an external program, optionally with command line arguments.  The program will be invoked and the contents of the file being extracted supplied
              to it on its standard input.  Additional data will be supplied via the following environment variables:

              TAR_FILETYPE
                     Type of the file. It is a single letter with the following meaning:

                             f           Regular file
                             d           Directory
                             l           Symbolic link
                             h           Hard link
                             b           Block device
                             c           Character device

                     Currently only regular files are supported.

              TAR_MODE
                     File mode, an octal number.

              TAR_FILENAME
                     The name of the file.

              TAR_REALNAME
                     Name of the file as stored in the archive.

              TAR_UNAME
                     Name of the file owner.

              TAR_GNAME
                     Name of the file owner group.

              TAR_ATIME
                     Time of last access. It is a decimal number, representing seconds since the Epoch.  If the archive provides times with nanosecond precision, the nanoseconds are appended to the timestamp after a  decimal
                     point.

              TAR_MTIME
                     Time of last modification.

              TAR_CTIME
                     Time of last status change.

              TAR_SIZE
                     Size of the file.

              TAR_UID
                     UID of the file owner.

              TAR_GID
                     GID of the file owner.

              Additionally, the following variables contain information about tar operation mode and the archive being processed:

              TAR_VERSION
                     GNU tar version number.

              TAR_ARCHIVE
                     The name of the archive tar is processing.

              TAR_BLOCKING_FACTOR
                     Current blocking factor, i.e. number of 512‐byte blocks in a record.

              TAR_VOLUME
                     Ordinal number of the volume tar is processing (set if reading a multi‐volume archive).

              TAR_FORMAT
                     Format of the archive being processed.  One of: gnu, oldgnu, posix, ustar, v7.

              TAR_SUBCOMMAND
                     A short option (with a leading dash) describing the operation tar is executing.

   Handling of file attributes
       --atime-preserve[=METHOD]
              Preserve access times

Title: GNU tar: Output Stream Selection and File Attribute Handling
Summary
This section covers options for output stream selection, including ignoring command errors (--ignore-command-error), extracting to standard output (-O, --to-stdout), and piping extracted files to a command (--to-command), providing environment variables with file metadata (TAR_FILETYPE, TAR_MODE, TAR_FILENAME, etc.). It also introduces file attribute handling with the --atime-preserve option for preserving access times.