Print this page
3474 tar should support -C on extract
Reviewed by: Robert Mustacchi <rm@joyent.com>
   1 '\" te
   2 .\" Copyright 1989 AT&T
   3 .\" Copyright (c) 2006, Sun Microsystems, Inc. All Rights Reserved
   4 .\" Copyright 2012 Milan Jurik. All rights reserved.

   5 .\" Portions Copyright (c) 1992, X/Open Company Limited All Rights Reserved
   6 .\" Sun Microsystems, Inc. gratefully acknowledges The Open Group for permission to reproduce portions of its copyrighted documentation. Original documentation from The Open Group can be obtained online at
   7 .\" http://www.opengroup.org/bookstore/.
   8 .\" The Institute of Electrical and Electronics Engineers and The Open Group, have given us permission to reprint portions of their documentation. In the following statement, the phrase "this text" refers to portions of the system documentation. Portions of this text are reprinted and reproduced in electronic form in the Sun OS Reference Manual, from IEEE Std 1003.1, 2004 Edition, Standard for Information Technology -- Portable Operating System Interface (POSIX), The Open Group Base Specifications Issue 6, Copyright (C) 2001-2004 by the Institute of Electrical and Electronics Engineers, Inc and The Open Group. In the event of any discrepancy between these versions and the original IEEE and The Open Group Standard, the original IEEE and The Open Group Standard is the referee document. The original Standard can be obtained online at http://www.opengroup.org/unix/online.html.
   9 .\"  This notice shall appear on any product containing this material.
  10 .\" The contents of this file are subject to the terms of the Common Development and Distribution License (the "License").  You may not use this file except in compliance with the License.
  11 .\" You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE or http://www.opensolaris.org/os/licensing.  See the License for the specific language governing permissions and limitations under the License.
  12 .\" When distributing Covered Code, include this CDDL HEADER in each file and include the License file at usr/src/OPENSOLARIS.LICENSE.  If applicable, add the following below this CDDL HEADER, with the fields enclosed by brackets "[]" replaced with your own identifying information: Portions Copyright [yyyy] [name of copyright owner]
  13 .TH TAR 1 "May 9, 2012"
  14 .SH NAME
  15 tar \- create tape archives and add or extract files
  16 .SH SYNOPSIS
  17 .LP
  18 .nf
  19 \fBtar\fR c[BDeEFhilnopPqTvw@/[0-7]][bfk][X...][a|j|J|z|Z] [\fIblocksize\fR]
  20      [\fItarfile\fR] [\fIsize\fR] [\fIexclude-file\fR]...
  21      {\fIfile\fR | \(miI \fIinclude-file\fR | \(miC \fIdirectory\fR \fIfile\fR}...
  22 .fi
  23 
  24 .LP
  25 .nf
  26 \fBtar\fR r[BDeEFhilnqTvw@/[0-7]][bfk][j|J|z|Z] [\fIblocksize\fR] [\fItarfile\fR]
  27      [\fIsize\fR]
  28      {\fIfile\fR | \(miI \fIinclude-file\fR | \(miC \fIdirectory\fR \fIfile\fR}...
  29 .fi
  30 
  31 .LP
  32 .nf
  33 \fBtar\fR t[BeFhilnqTv[0-7]][fk][X...][j|J|z|Z] [\fItarfile\fR] [\fIsize\fR]
  34      [\fIexclude-file\fR]... {\fIfile\fR | \(miI \fIinclude-file\fR}...
  35 .fi
  36 
  37 .LP
  38 .nf
  39 \fBtar\fR u[BDeEFhilnqTvw@/[0-7]][bfk][j|J|z|Z] [\fIblocksize\fR] [\fItarfile\fR]
  40      [\fIsize\fR] \fIfile\fR...
  41 .fi
  42 
  43 .LP
  44 .nf
  45 \fBtar\fR x[BeFhilmnopqTvw@/[0-7]][fk][X...][j|J|z|Z] [\fItarfile\fR] [\fIsize\fR]
  46      [\fIexclude-file\fR]... [\fIfile\fR]...
  47 .fi
  48 
  49 .SH DESCRIPTION
  50 .sp
  51 .LP
  52 The \fBtar\fR command archives and extracts files to and from a single file
  53 called a \fItarfile\fR. A tarfile is usually a magnetic tape, but it can be any
  54 file. \fBtar\fR's actions are controlled by the \fIkey\fR argument. The
  55 \fIkey\fR is a string of characters containing exactly one function letter
  56 (\fBc\fR, \fBr\fR, \fBt\fR , \fBu\fR, or \fBx\fR) and zero or more function
  57 modifiers (letters or digits), depending on the function letter used. The
  58 \fIkey\fR string contains no SPACE characters. Function modifier arguments are
  59 listed on the command line in the same order as their corresponding function
  60 modifiers appear in the \fIkey\fR string.
  61 .sp
  62 .LP
  63 The \fB\(miI\fR \fIinclude-file\fR, \fB\(miC\fR \fIdirectory file\fR, and
  64 \fIfile\fR arguments specify which files or directories are to be archived or
  65 extracted. In all cases, appearance of a directory name refers to the files and
  66 (recursively) subdirectories of that directory. Arguments appearing within
  67 braces (\fB{ }\fR) indicate that one of the arguments must be specified.
  68 .SH OPERANDS
  69 .sp
  70 .LP
  71 The following operands are supported:
  72 .sp
  73 .ne 2
  74 .na
  75 \fB\fB\(miC\fR \fIdirectory file\fR\fR
  76 .ad
  77 .sp .6
  78 .RS 4n
  79 Performs a \fBchdir\fR (see \fBcd\fR(1)) operation on \fIdirectory\fR and
  80 performs the \fBc\fR (create) or \fBr\fR (replace) operation on \fIfile\fR. Use
  81 short relative path names for \fIfile\fR. If \fIfile\fR is "\fB\&.\fR", archive
  82 all files in \fIdirectory\fR. This operand enables archiving files from
  83 multiple directories not related by a close common parent.




  84 .RE
  85 
  86 .sp
  87 .ne 2
  88 .na
  89 \fB\fB\(miI\fR \fIinclude-file\fR\fR
  90 .ad
  91 .sp .6
  92 .RS 4n
  93 Opens \fIinclude-file\fR containing a list of files, one per line, and treats
  94 it as if each file appeared separately on the command line. Be careful of
  95 trailing white spaces. Also beware of leading white spaces, since, for each
  96 line in the included file, the entire line (apart from the newline) is used to
  97 match against the initial string of files to include. In the case where
  98 excluded files (see \fBX\fR function modifier) are also specified, they take
  99 precedence over all included files. If a file is specified in both the
 100 \fIexclude-file\fR and the \fIinclude-file\fR (or on the command line), it is
 101 excluded.
 102 .RE
 103 


   1 '\" te
   2 .\" Copyright 1989 AT&T
   3 .\" Copyright (c) 2006, Sun Microsystems, Inc. All Rights Reserved
   4 .\" Copyright 2012 Milan Jurik. All rights reserved.
   5 .\" Copyright (c) 2013, Joyent, Inc. All rights reserved.
   6 .\" Portions Copyright (c) 1992, X/Open Company Limited All Rights Reserved
   7 .\" Sun Microsystems, Inc. gratefully acknowledges The Open Group for permission to reproduce portions of its copyrighted documentation. Original documentation from The Open Group can be obtained online at
   8 .\" http://www.opengroup.org/bookstore/.
   9 .\" The Institute of Electrical and Electronics Engineers and The Open Group, have given us permission to reprint portions of their documentation. In the following statement, the phrase "this text" refers to portions of the system documentation. Portions of this text are reprinted and reproduced in electronic form in the Sun OS Reference Manual, from IEEE Std 1003.1, 2004 Edition, Standard for Information Technology -- Portable Operating System Interface (POSIX), The Open Group Base Specifications Issue 6, Copyright (C) 2001-2004 by the Institute of Electrical and Electronics Engineers, Inc and The Open Group. In the event of any discrepancy between these versions and the original IEEE and The Open Group Standard, the original IEEE and The Open Group Standard is the referee document. The original Standard can be obtained online at http://www.opengroup.org/unix/online.html.
  10 .\"  This notice shall appear on any product containing this material.
  11 .\" The contents of this file are subject to the terms of the Common Development and Distribution License (the "License").  You may not use this file except in compliance with the License.
  12 .\" You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE or http://www.opensolaris.org/os/licensing.  See the License for the specific language governing permissions and limitations under the License.
  13 .\" When distributing Covered Code, include this CDDL HEADER in each file and include the License file at usr/src/OPENSOLARIS.LICENSE.  If applicable, add the following below this CDDL HEADER, with the fields enclosed by brackets "[]" replaced with your own identifying information: Portions Copyright [yyyy] [name of copyright owner]
  14 .TH TAR 1 "Jan 16, 2013"
  15 .SH NAME
  16 tar \- create tape archives and add or extract files
  17 .SH SYNOPSIS
  18 .LP
  19 .nf
  20 \fBtar\fR c[BDeEFhilnopPqTvw@/[0-7]][bfk][X...][a|j|J|z|Z] [\fIblocksize\fR]
  21      [\fItarfile\fR] [\fIsize\fR] [\fIexclude-file\fR]...
  22      {\fIfile\fR | \(miI \fIinclude-file\fR | \(miC \fIdirectory\fR \fIfile\fR}...
  23 .fi
  24 
  25 .LP
  26 .nf
  27 \fBtar\fR r[BDeEFhilnqTvw@/[0-7]][bfk][j|J|z|Z] [\fIblocksize\fR] [\fItarfile\fR]
  28      [\fIsize\fR]
  29      {\fIfile\fR | \(miI \fIinclude-file\fR | \(miC \fIdirectory\fR \fIfile\fR}...
  30 .fi
  31 
  32 .LP
  33 .nf
  34 \fBtar\fR t[BeFhilnqTv[0-7]][fk][X...][j|J|z|Z] [\fItarfile\fR] [\fIsize\fR]
  35      [\fIexclude-file\fR]... {\fIfile\fR | \(miI \fIinclude-file\fR}...
  36 .fi
  37 
  38 .LP
  39 .nf
  40 \fBtar\fR u[BDeEFhilnqTvw@/[0-7]][bfk][j|J|z|Z] [\fIblocksize\fR] [\fItarfile\fR]
  41      [\fIsize\fR] \fIfile\fR...
  42 .fi
  43 
  44 .LP
  45 .nf
  46 \fBtar\fR x[BeFhilmnopqTvw@/[0-7]][fk][X...][j|J|z|Z] [\fItarfile\fR] [\fIsize\fR]
  47      [\fIexclude-file\fR]... [\(miC \fIdirectory\fR] [\fIfile\fR]...
  48 .fi
  49 
  50 .SH DESCRIPTION
  51 .sp
  52 .LP
  53 The \fBtar\fR command archives and extracts files to and from a single file
  54 called a \fItarfile\fR. A tarfile is usually a magnetic tape, but it can be any
  55 file. \fBtar\fR's actions are controlled by the \fIkey\fR argument. The
  56 \fIkey\fR is a string of characters containing exactly one function letter
  57 (\fBc\fR, \fBr\fR, \fBt\fR , \fBu\fR, or \fBx\fR) and zero or more function
  58 modifiers (letters or digits), depending on the function letter used. The
  59 \fIkey\fR string contains no SPACE characters. Function modifier arguments are
  60 listed on the command line in the same order as their corresponding function
  61 modifiers appear in the \fIkey\fR string.
  62 .sp
  63 .LP
  64 The \fB\(miI\fR \fIinclude-file\fR, \fB\(miC\fR \fIdirectory file\fR, and
  65 \fIfile\fR arguments specify which files or directories are to be archived or
  66 extracted. In all cases, appearance of a directory name refers to the files and
  67 (recursively) subdirectories of that directory. Arguments appearing within
  68 braces (\fB{ }\fR) indicate that one of the arguments must be specified.
  69 .SH OPERANDS
  70 .sp
  71 .LP
  72 The following operands are supported:
  73 .sp
  74 .ne 2
  75 .na
  76 \fB\fB\(miC\fR \fIdirectory file\fR\fR
  77 .ad
  78 .sp .6
  79 .RS 4n
  80 Performs a \fBchdir\fR (see \fBcd\fR(1)) operation on \fIdirectory\fR and
  81 performs the \fBc\fR (create) or \fBr\fR (replace) operation on \fIfile\fR. Use
  82 short relative path names for \fIfile\fR. If \fIfile\fR is "\fB\&.\fR", archive
  83 all files in \fIdirectory\fR. This operand enables archiving files from
  84 multiple directories not related by a close common parent.
  85 .sp
  86 This option may also be passed once to \fBx\fR (extract).  In this case the
  87 program will \fBchdir\fR to \fIdirectory\fR after opening the archive, but
  88 before extracting its contents.
  89 .RE
  90 
  91 .sp
  92 .ne 2
  93 .na
  94 \fB\fB\(miI\fR \fIinclude-file\fR\fR
  95 .ad
  96 .sp .6
  97 .RS 4n
  98 Opens \fIinclude-file\fR containing a list of files, one per line, and treats
  99 it as if each file appeared separately on the command line. Be careful of
 100 trailing white spaces. Also beware of leading white spaces, since, for each
 101 line in the included file, the entire line (apart from the newline) is used to
 102 match against the initial string of files to include. In the case where
 103 excluded files (see \fBX\fR function modifier) are also specified, they take
 104 precedence over all included files. If a file is specified in both the
 105 \fIexclude-file\fR and the \fIinclude-file\fR (or on the command line), it is
 106 excluded.
 107 .RE
 108