gnucpio" -- Command" "
Archiving/backup utility
_C_o_p_y_-_i_n _m_o_d_e_: ccppiioo {{--oo||----ccrreeaattee}} [[--00aaccvvAABBLLVV]] [[--CC _b_y_t_e_s]] [[--HH
_f_o_r_m_a_t]] [[--MM _m_e_s_s_a_g_e]] [[--OO [[[[_u_s_e_r@@]]_h_o_s_t::]]_a_r_c_h_i_v_e]] [[--FF
[[[[_u_s_e_r@@]]_h_o_s_t::]]_a_r_c_h_i_v_e]] [--file=[[_u_s_e_r@@]]_h_o_s_t::]]_a_r_c_h_i_v_e]]
[[----ffoorrmmaatt==_f_o_r_m_a_t]] [[----mmeessssaaggee==_m_e_s_s_a_g_e]] [[----nnuullll]] [[----rreesseett--
aacccceessss--ttiimmee]] [[----vveerrbboossee]] [[----ddoott]] [[----aappppeenndd]] [[----bblloocckk--
ssiizzee==bblloocckkss]] [[----ddeerreeffeerreennccee]] [[----iioo--ssiizzee==_b_y_t_e_s]] [[----vveerrssiioonn]]
&&lltt;; _n_a_m_e_-_l_i_s_t [[&&ggtt;; _a_r_c_h_i_v_e]]
_C_o_p_y_-_o_u_t _m_o_d_e_: ccppiioo {{--ii||----eexxttrraacctt}} [[--bbccddffmmnnrrttssuuvvBBSSVV]] [[--CC
_b_y_t_e_s]] [[--EE _f_i_l_e]] [[--HH _f_o_r_m_a_t]] [[--MM _m_e_s_s_a_g_e]] [[--RR
[[_u_s_e_r]][[::..]][[_g_r_o_u_p]]]] [[--II [[[[_u_s_e_r@@]]_h_o_s_t::]]_a_r_c_h_i_v_e]] [[--FF
[[[[_u_s_e_r@@]]_h_o_s_t::]]_a_r_c_h_i_v_e]] [[----ffiillee==[[[[_u_s_e_r@@]]_h_o_s_t::]]_a_r_c_h_i_v_e]]
[[----mmaakkee--ddiirreeccttoorriieess]] [[----nnoonnmmaattcchhiinngg]] [[----pprreesseerrvvee--
mmooddiiffiiccaattiioonn--ttiimmee]] [[----nnuummeerriicc--uuiidd--ggiidd]] [[----rreennaammee]] [[----lliisstt]]
[[----sswwaapp--bbyytteess]] [[----sswwaapp]] [[----ddoott]] [[----uunnccoonnddiittiioonnaall]]
[[----vveerrbboossee]] [[----bblloocckk--ssiizzee==_b_l_o_c_k_s]] [[----sswwaapp--hhaallffwwoorrddss]] [[----iioo--
ssiizzee==_b_y_t_e_s]] [[----ppaatttteerrnn--ffiillee==_f_i_l_e]] [[----ffoorrmmaatt==_f_o_r_m_a_t]]
[[----oowwnneerr==[[_u_s_e_r]][[::..]][[_g_r_o_u_p]]]] [[----nnoo--pprreesseerrvvee--oowwnneerr]]
[[----mmeessssaaggee==_m_e_s_s_a_g_e]] [[----vveerrssiioonn]] [[_p_a_t_t_e_r_n_._._.]] [[&&lltt;; _a_r_c_h_i_v_e]]
_C_o_p_y_-_t_h_r_o_u_g_h _m_o_d_e_: ccppiioo {{--pp||----ppaassss--tthhrroouugghh}} [[--00aaddllmmuuvvLLVV]] [[--RR
[[_u_s_e_r]][[::..]][[_g_r_o_u_p]]]] [[----nnuullll]] [[----rreesseett--aacccceessss--ttiimmee]] [[----mmaakkee--
ddiirreeccttoorriieess]] [[----lliinnkk]] [[----pprreesseerrvvee--mmooddiiffiiccaattiioonn--ttiimmee]]
[[----uunnccoonnddiittiioonnaall]] [[----vveerrbboossee]] [[----ddoott]] [[----ddeerreeffeerreennccee]]
[[----oowwnneerr==[[_u_s_e_r]][[::..]][[_g_r_o_u_p]]]] [[----nnoo--pprreesseerrvvee--oowwnneerr]]
[[----vveerrssiioonn]] _d_e_s_t_i_n_a_t_i_o_n_-_d_i_r_e_c_t_o_r_y &&lltt;; _n_a_m_e_-_l_i_s_t
gnucpio is the GNU version of the archive
utility cpio. It copies files into or out of a
cpio or tar archive, which
is a file that contains other files plus information about
them, such as their pathname, owner, timestamps, and access
permissions. The archive can be another file on the disk, a
magnetic tape, or a pipe.
gnucpio has three operating modes.
- _C_o_p_y_-_o_u_t _M_o_d_e
- gnucpio copies files into an archive.
It reads a list of file names, one per line, from the
standard input, and writes the archive onto the standard
output.
- _C_o_p_y_-_i_n _M_o_d_e
- gnucpio copies files from an archive
or lists the archive's contents. It reads the archive from
the standard input. Any non-option command-line arguments
are shell wild-card patterns; only files in the archive
whose names match one or more of those patterns are copied
from the archive. Unlike in the shell, an initial `.' in a
file name does match a wildcard at the start of a pattern,
and a `/' in a file name can match wildcards. If the
command line contains no pattern, gnucpio
extracts all files.
- _C_o_p_y_-_p_a_s_s _M_o_d_e
- gnucpio copies files from one
directory tree to another. This combines the copy-out and
copy-in steps without actually using an archive. It reads
the list of files to copy from the standard input; the
directory into which it copies them is given as a non-option
argument.
gnucpio supports the following archive
formats: binary, old ASCII, new ASCII, crc,
old tar, and POSIX.1 tar. The
binary format is obsolete because it encodes information
about the files in a way that is not portable between
different machine architectures. The old ASCII format is
portable between different machine architectures, but should
not be used on file systems with more than 65536 i-nodes.
The new ASCII format is portable between different machine
architectures and can be used on any size file system, but
is not supported by all versions of cpio;
currently, it is only supported by GNU and UNIX System V R4.
The crc format resembles the new ASCII
format, but also contains a checksum for each file that
gnucpio calculates when creating an archive
and verifies when the file is extracted from the archive.
tar format is provided for compatability
with the command tar. It can not be used to
archive a file whose name exceeds 100 characters, and cannot
be used to archive block or character devices. The POSIX.1
tar format can not be used to archive a
file whose name exceeds 255 characters (less unless it has a
`/' in just the right place).
By default, gnucpio creates binary
archives, for compatibility with older cpio
programs. When extracting from archives,
gnucpio automatically recognizes the kind
of archive it is reading, and can read archives created on
machines with a different byte-order.
Options
gnucpio recognizes the following command-
line options. Not every option applies to every mode. You
can prefix the long-named options with an `+' as well as
with an `--', for compatibility with previous releases.
Eventually, support for `+' will be removed, because it is
incompatible with the POSIX Standard".
- --00
-
- ----nnuullll
- In copy-out and copy-pass modes, read a list of file
names terminated by a null character instead of a newline.
This permits gnucpio to archive files whose
names contain newlines.
- --aa
-
- ----rreesseett--aacccceessss--ttiimmee
- Reset the access times of files after reading them, so
that it does not look like they have just been read.
- --AA
-
- ----aappppeenndd
- Append to an existing archive. Only works in copy-out
mode. The archive must be a disk file specified with the
options -O or -F.
- --bb
-
- ----sswwaapp
- In copy-in mode, swap both halfwords of words and bytes
of halfwords in the data. Equivalent to the option
-sS. Use this option to convert 32-bit
integers between big-endian and little-endian machines.
- --BB
- Set the I/O block size to 5,120 bytes. Initially, the
block size is 512 bytes.
- ----bblloocckk--ssiizzee==_b_l_o_c_k_s
<> SSeett tthhee bblloocckk ssiizzee ttoo _b_l_o_c_k_sx512 bytes.
- --cc
- Use the old portable (ASCII) archive format.
- --CC _s_i_z_e
-
- ----iioo--ssiizzee==_s_i_z_e
- Set the I/O block size to size bytes.
- --dd
-
- ----mmaakkee--ddiirreeccttoorriieess
- Create leading directories where needed.
- --EE ffiillee
-
- ----ppaatttteerrnn--ffiillee==_f_i_l_e
- In copy-in mode, read from file additional
patterns that specify file names to extract or list.
gnucpio treats the lines of file
as if they had been non-option arguments to
gnucpio.
- --ff
-
- ----nnoonnmmaattcchhiinngg
- Copy only the files that do not match any of
the given patterns.
- --FF
-
- ----ffiillee==_a_r_c_h_i_v_e
- Read to or write from archive instead of the
standard input or output. When you use this option, you do
not have to specify the output device for each volume of a
multi-volume backup.
- ----ffoorrccee--llooccaall
- With options -F, -I, or
-O, take the archive file name to be a local
file even if it contains a colon (which ordinarily names a
remote host).
- --HH _f_o_r_m_a_t
-
- ----ffoorrmmaatt==_f_o_r_m_a_t
- Use archive format format. The valid
formats are listed below; gnucpio also
recognizes these names if given in capital letters. The
default in copy-in mode is to detect automatically the
archive format, and in copy-out mode is bin.
- bbiinn
- The obsolete binary format.
- ooddcc
- The old (POSIX.1) portable format.
- nneewwcc
- The new (SVR4) portable format, which supports file
systems that have more than 65536 i-nodes.
- ccrrcc
- The new (SVR4) portable format with a checksum added.
- ttaarr
- The old tar format.
- uussttaarr
- The POSIX.1 tar format. Also
recognizes GNU tar archives, which are
similar but not identical.
- --ii
-
- ----eexxttrraacctt
- Run in copy-in mode.
- --II _a_r_c_h_i_v_e
- Archive file name to use instead of standard input.
- --kk
- This option exists only for compatibility with other
versions of cpio. It is ignored.
- --ll
-
- ----lliinnkk
- Whenever possible, link files instead of copying them.
- --LL
-
- ----ddeerreeffeerreennccee
- Dereference symbolic links -- that is, copy the files
that they point to instead of copying the links.
- ""--mm"
-
- ----pprreesseerrvvee--mmooddiiffiiccaattiioonn--ttiimmee
- Retain previous file-modification times when creating
files.
- --MM _m_e_s_s_a_g_e
-
- ----mmeessssaaggee==_m_e_s_s_a_g_e
- Print message when gnucpio
reaches the end of a volume of the back-up medium (such as a
tape or a floppy disk), to prompt the user to insert a new
volume. If message contains the string
%d, gnucpio replaces that
string with the number of the current volume (starting at
one).
- --nn
-
- ----nnuummeerriicc--uuiidd--ggiidd
- In the verbose table of contents listing, show the
numeric UID and GID instead of translating them into names.
- ----nnoo--pprreesseerrvvee--oowwnneerr
- In copy-in and copy-pass modes, do not change the
ownership of the files: leave them owned by the user who
extracts them. This is the default for non-root users, so
that users on System-V UNIX do not inadvertantly give away
files.
- --oo
-
- ----ccrreeaattee
- Run in copy-out mode.
- --OO _a_r_c_h_i_v_e
- Write output into archive instead of to the
standard output.
- --pp
-
- ----ppaassss--tthhrroouugghh
- Run in copy-pass mode.
- --rr
-
- ----rreennaammee
- Interactively rename files.
- --RR [[_u_s_e_r]][[::..]][[_g_r_o_u_p]]
-
- ----oowwnneerr [[_u_s_e_r]][[::..]][[_g_r_o_u_p]]
- In copy-out and copy-pass modes, set the ownership of
all files created to user and group.
Either the user or the group, or both, must be present. If
the group is omitted but the `:' or `.' separator is given,
gnucpio uses the user's login group. Only
the super-user can change files' ownership.
- --ss
-
- ----sswwaapp--bbyytteess
- In copy-in mode, swap the bytes of each halfword (pair
of bytes) in the files.
- --SS
-
- ----sswwaapp--hhaallffwwoorrddss
- In copy-in mode, swap the halfwords of each word (four
bytes) in the files.
- --tt
-
- ----lliisstt
- Print a table of contents of the input.
- --uu
-
- ----uunnccoonnddiittiioonnaall
- Replace all files, without asking whether to replace
existing newer files with older files.
- --vv
-
- ----vveerrbboossee
- List the files processed. When used with the option
-t, give a listing that resembles the output
of the command ls -l. In a verbose table of
contents of a ustar archive, user and group
names in the archive that do not exist on the local system
are replaced by the names that correspond locally to the
numeric UID and GID stored in the archive.
- --VV ----ddoott
- Print a `.' for each file processed.
- ----vveerrssiioonn
- Print the number of the version of
gnucpio that you are now running, and exit.
Examples
The following command copies all files and directories
listed by the command find and copies them
into the archive newfile.cpio:
find . -print | cpio -oc > ../newfile.cpio
The following command reads the cpio
archive newfile.cpio and extracts all files
whose names match the patterns memo/al or
memo/b*:
cpio -icdv "memo/al" "memo/b*" <../newfile.cpio
Note that the --dd option forces cpio to
create the sub-directory memo and write the
files into it. Otherwise, the files would have been written
into the current directory. Option -v
causes cpio to display each file name as it
is extracted from the archive.
The following commands perform a multi-volume backup of all
files on mounted filesystem /v to the
character-special (i.e., ``raw'') floppy device
/dev/rfha0:
su root
cd /v
find . -print | cpio -ocv >/dev/rfha0
If the cpio archive exceeds one floppy
disk, you will be prompted to insert another.
See Also
Notes
COHERENT does not yet support networking. The above
descriptions of host addressing do not yet apply.
A
gnucpio is released under the conditions of
the Free Software Foundation's ``copyleft''. Full source
code is available through the Mark Williams bulletin board.