TAR(1) NetBSD General Commands Manual TAR(1) NNAAMMEE ttaarr - tape archiver SSYYNNOOPPSSIISS ttaarr [-]{crtux}[--bbeeffhhjjkkllmmooppqqvvwwzzHHLLOOPPXXZZ001144557788] [_a_r_c_h_i_v_e] [_b_l_o_c_k_s_i_z_e] [--CC _d_i_r_e_c_t_o_r_y] [--TT _f_i_l_e] [--ss _r_e_p_l_s_t_r] [_f_i_l_e _._._.] DDEESSCCRRIIPPTTIIOONN The ttaarr command creates, adds files to, or extracts files from an archive file in ``tar'' format. A tar archive is often stored on a magnetic tape, but can be stored equally well on a floppy, CD-ROM, or in a regular disk file. One of the following flags must be present: --cc, ----ccrreeaattee Create new archive, or overwrite an existing archive, adding the specified files to it. --rr, ----aappppeenndd Append the named new files to existing archive. Note that this will only work on media on which an end-of-file mark can be overwritten. --tt, ----lliisstt List contents of archive. If any files are named on the command line, only those files will be listed. --uu, ----uuppddaattee Alias for --rr. --xx, ----eexxttrraacctt, ----ggeett Extract files from archive. If any files are named on the command line, only those files will be extracted from the archive. If more than one copy of a file exists in the ar- chive, later copies will overwrite earlier copies during extraction. The file mode and modification time are pre- served if possible. The file mode is subject to modifica- tion by the umask(2). In addition to the flags mentioned above, any of the following flags may be used: --bb _b_l_o_c_k_i_n_g _f_a_c_t_o_r, ----bblloocckk--ssiizzee _b_l_o_c_k_i_n_g _f_a_c_t_o_r Set blocking factor to use for the archive. ttaarr uses 512 byte blocks. The default is 20, the maximum is 126. Ar- chives with a blocking factor larger 63 violate the POSIX standard and will not be portable to all systems. --ee Stop after first error. --ff _a_r_c_h_i_v_e, ----ffiillee _a_r_c_h_i_v_e Filename where the archive is stored. Defaults to _/_d_e_v_/_r_s_t_0. If the archive is of the form: _[_[_u_s_e_r_@_]_h_o_s_t_:_]_f_i_l_e then the archive will be processed using rmt(8). --hh, ----ddeerreeffeerreennccee Follow symbolic links as if they were normal files or directories. --jj,, ----bbzziipp22,, ----bbuunnzziipp22 Use bzip2(1) for compression of the archive. This option is a GNU extension. --kk, ----kkeeeepp--oolldd--ffiilleess Keep existing files; don't overwrite them from archive. --ll, ----oonnee--ffiillee--ssyysstteemm Do not cross filesystems. --mm, ----mmooddiiffiiccaattiioonn--ttiimmee Do not preserve modification time. --OO When creating and appending to an archive, write old-style (non-POSIX) archives. When extracting from an archive, extract to standard output. --oo, ----ppoorrttaabbiilliittyy, ----oolldd--aarrcchhiivvee Don't write directory information that the older (V7) style ttaarr is unable to decode. This implies the --OO flag. --pp, ----pprreesseerrvvee--ppeerrmmiissssiioonnss, ----pprreesseerrvvee Preserve user and group ID as well as file mode regardless of the current umask(2). The setuid and setgid bits are only preserved if the user is the superuser. Only meaning- ful in conjunction with the --xx flag. --qq, ----ffaasstt--rreeaadd Select the first archive member that matches each _p_a_t_t_e_r_n operand. No more than one archive member is matched for each _p_a_t_t_e_r_n. When members of type directory are matched, the file hierarchy rooted at that directory is also matched. --ss _r_e_p_l_s_t_r Modify the file or archive member names specified by the _p_a_t_t_e_r_n or _f_i_l_e operands according to the substitution expression _r_e_p_l_s_t_r, using the syntax of the ed(1) utility regular expressions. The format of these regular expres- sions are: /old/new/[gp] As in ed(1), oolldd is a basic regular expression and nneeww can contain an ampersand (&), \n (where n is a digit) back-ref- erences, or subexpression matching. The oolldd string may also contain characters. Any non-null character can be used as a delimiter (/ is shown here). Multiple --ss expressions can be specified. The expressions are applied in the order they are specified on the command line, termi- nating with the first successful substitution. The optional trailing gg continues to apply the substitution expression to the pathname substring which starts with the first character following the end of the last successful substitution. The first unsuccessful substitution stops the operation of the gg option. The optional trailing pp will cause the final result of a successful substitution to be written to standard error in the following format: >> File or archive member names that substitute to the empty string are not selected and will be skipped. --vv Verbose operation mode. --ww, ----iinntteerraaccttiivvee, ----ccoonnffiirrmmaattiioonn Interactively rename files. This option causes ttaarr to prompt the user for the filename to use when storing or extracting files in an archive. --zz, ----ggzziipp, ----gguunnzziipp Compress archive using gzip. --BB, ----rreeaadd--ffuullll--bblloocckkss Reassemble small reads into full blocks (For reading from 4.2BSD pipes). --CC _d_i_r_e_c_t_o_r_y, ----ddiirreeccttoorryy _d_i_r_e_c_t_o_r_y This is a positional argument which sets the working direc- tory for the following files. When extracting, files will be extracted into the specified directory; when creating, the specified files will be matched from the directory. This argument and its parameter may also appear in a file list specified by --TT. --HH Follow symlinks given on command line only. --PP, ----aabbssoolluuttee--ppaatthhss Do not strip leading slashes (`/') from pathnames. The default is to strip leading slashes. --TT _f_i_l_e, ----ffiilleess--ffrroomm _f_i_l_e Read the names of files to archive or extract from the given file, one per line. A line may also specify the positional argument ``--CC _d_i_r_e_c_t_o_r_y''. --XX _f_i_l_e, ----eexxcclluuddee--ffrroomm _f_i_l_e Exclude files listed in the given file. --ZZ, ----ccoommpprreessss, ----uunnccoommpprreessss Compress archive using compress. ----ssttrriicctt Do not enable GNU tar extensions such as long filenames and long link names. ----aattiimmee--pprreesseerrvvee Preserve file access times. ----uunnlliinnkk Ignored, only accepted for compatibility with other ttaarr implementations. ttaarr always unlinks files before creating them. ----uussee--ccoommpprreessss--pprrooggrraamm _p_r_o_g_r_a_m Use the named program as the program to decompress the input. ----ffoorrccee--llooccaall Do not interpret filenames that contain a `:' as remote files. ----iinnsseeccuurree Normally ttaarr ignores filenames that contain `..' as a path component. With this option, files that contain `..' can be processed. The options [--001144557788] can be used to select one of the compiled-in backup devices, _/_d_e_v_/_r_s_t_N. FFIILLEESS /dev/rst0 default archive name DDIIAAGGNNOOSSTTIICCSS ttaarr will exit with one of the following values: 0 All files were processed successfully. 1 An error occurred. Whenever ttaarr cannot create a file or a link when extracting an archive or cannot find a file while writing an archive, or cannot preserve the user ID, group ID, file mode, or access and modification times when the --pp option is specified, a diagnostic message is written to standard error and a non-zero exit value will be returned, but processing will continue. In the case where ttaarr cannot create a link to a file, ttaarr will not create a second copy of the file. If the extraction of a file from an archive is prematurely terminated by a signal or error, ttaarr may have only partially extracted the file the user wanted. Additionally, the file modes of extracted files and direc- tories may have incorrect file bits, and the modification and access times may be wrong. If the creation of an archive is prematurely terminated by a signal or error, ttaarr may have only partially created the archive which may violate the specific archive format specification. SSEEEE AALLSSOO cpio(1), pax(1) HHIISSTTOORRYY A ttaarr command first appeared in Version 7 AT&T UNIX. AAUUTTHHOORRSS Keith Muller at the University of California, San Diego. NetBSD 2.0 May 4, 2004 NetBSD 2.0