xref: /386bsd/usr/share/man/cat1/cpio.0 (revision a2142627)
1
2
3
4CPIO(1L)                                                 CPIO(1L)
5
6
7NNAAMMEE
8       cpio - copy files to and from archives
9
10SSYYNNOOPPSSIISS
11       ccppiioo  {-o|--create} [-0acvABLV] [-C bytes] [-H format] [-M
12       message]       [-O       [[user@]host:]archive]        [-F
13       [[user@]host:]archive]      [--file=[[user@]host:]archive]
14       [--format=format] [--message=message]  [--null]  [--reset-
15       access-time]   [--verbose]  [--dot]  [--append]  [--block-
16       size=blocks]  [--dereference]  [--io-size=bytes]  [--help]
17       [--version] < name-list [> archive]
18
19       ccppiioo {-i|--extract} [-bcdfmnrtsuvBSV] [-C bytes] [-E file]
20       [-H  format]  [-M  message]  [-R  [user][:.][group]]   [-I
21       [[user@]host:]archive]      [-F     [[user@]host:]archive]
22       [--file=[[user@]host:]archive]        [--make-directories]
23       [--nonmatching] [--preserve-modification-time] [--numeric-
24       uid-gid]  [--rename]  [--list]   [--swap-bytes]   [--swap]
25       [--dot]     [--unconditional]     [--verbose]    [--block-
26       size=blocks]     [--swap-halfwords]      [--io-size=bytes]
27       [--pattern-file=file]                    [--format=format]
28       [--owner=[user][:.][group]]          [--no-preserve-owner]
29       [--message=message]  [--help]  [--version] [pattern...] [<
30       archive]
31
32       ccppiioo      {-p|--pass-through}       [-0adlmuvLV]       [-R
33       [user][:.][group]] [--null] [--reset-access-time] [--make-
34       directories]    [--link]    [--preserve-modification-time]
35       [--unconditional]   [--verbose]   [--dot]  [--dereference]
36       [--owner=[user][:.][group]] [--no-preserve-owner] [--help]
37       [--version] destination-directory < name-list
38
39DDEESSCCRRIIPPTTIIOONN
40       This  manual page documents the GNU version of ccppiioo.  ccppiioo
41       copies files into or out of a cpio or tar  archive,  which
42       is a file that contains other files plus information about
43       them, such  as  their  pathname,  owner,  timestamps,  and
44       access  permissions.   The  archive can be another file on
45       the disk, a magnetic tape, or  a  pipe.   ccppiioo  has  three
46       operating modes.
47
48       In  copy-out  mode, ccppiioo copies files into an archive.  It
49       reads a list of filenames, one per line, on  the  standard
50       input, and writes the archive onto the standard output.  A
51       typical way to generate the list of filenames is with  the
52       ffiinndd  command;  you  should give ffiinndd the -depth option to
53       minimize problems with permissions on directories that are
54       unwritable or not searchable.
55
56       In  copy-in  mode,  ccppiioo copies files out of an archive or
57       lists the archive contents.  It reads the archive from the
58       standard input.  Any non-option command line arguments are
59       shell globbing patterns; only files in the  archive  whose
60       names  match one or more of those patterns are copied from
61
62
63
64                                                                1
65
66
67
68
69
70CPIO(1L)                                                 CPIO(1L)
71
72
73       the archive.  Unlike in the shell, an  initial  `.'  in  a
74       filename  does match a wildcard at the start of a pattern,
75       and a `/' in  a  filename  can  match  wildcards.   If  no
76       patterns are given, all files are extracted.
77
78       In  copy-pass  mode,  ccppiioo copies files from one directory
79       tree to another, combining the copy-out and copy-in  steps
80       without  actually  using an archive.  It reads the list of
81       files to copy from the standard input; the directory  into
82       which it will copy them is given as a non-option argument.
83
84       ccppiioo supports the following archive formats:  binary,  old
85       ASCII,  new  ASCII,  crc, HPUX binary, HPUX old ASCII, old
86       tar, and POSIX.1  tar.   The  binary  format  is  obsolete
87       because  it  encodes  information about the files in a way
88       that   is   not   portable   between   different   machine
89       architectures.   The  old ASCII format is portable between
90       different machine architectures, but should not be used on
91       file  systems with more than 65536 i-nodes.  The new ASCII
92       format is portable between different machine architectures
93       and  can  be  used  on  any  size  file system, but is not
94       supported by all versions of ccppiioo; currently, it  is  only
95       supported  by GNU and Unix System V R4.  The crc format is
96       like the new ASCII format, but also  contains  a  checksum
97       for  each  file  which  ccppiioo  calculates  when creating an
98       archive and verifies when the file is extracted  from  the
99       archive.   The HPUX formats are provided for compatibility
100       with HPUX's cpio which stores device files differently.
101
102       The tar format is provided for compatability with the  ttaarr
103       program.   It  can not be used to archive files with names
104       longer than 100 characters, and can not be used to archive
105       "special" (block or character devices) files.  The POSIX.1
106       tar format can not be used to  archive  files  with  names
107       longer than 255 characters (less unless they have a "/" in
108       just the right place).
109
110       By default,  ccppiioo  creates  binary  format  archives,  for
111       compatibility  with  older ccppiioo programs.  When extracting
112       from archives, ccppiioo automatically recognizes which kind of
113       archive  it  is  reading  and can read archives created on
114       machines with a different byte-order.
115
116       Some  of  the  options  to  ccppiioo  apply  only  to  certain
117       operating  modes;  see  the SYNOPSIS section for a list of
118       which options are allowed in which modes.
119
120   OOPPTTIIOONNSS
121       -_0, --_n_u_l_l
122              In copy-out and copy-pass modes,  read  a  list  of
123              filenames terminated by a null character instead of
124              a  newline,  so  that  files  whose  names  contain
125              newlines  can  be archived.  GNU ffiinndd is one way to
126              produce a list of null-terminated filenames.
127
128
129
130                                                                2
131
132
133
134
135
136CPIO(1L)                                                 CPIO(1L)
137
138
139       -_a, --_r_e_s_e_t-_a_c_c_e_s_s-_t_i_m_e
140              Reset the access times of files after reading them,
141              so  that  it does not look like they have just been
142              read.
143
144       -_A, --_a_p_p_e_n_d
145              Append to an existing archive.  Only works in copy-
146              out   mode.   The  archive  must  be  a  disk  file
147              specified with the -_O or -_F (--_f_i_l_e) option.
148
149       -_b, --_s_w_a_p
150              In copy-in mode, swap both halfwords of  words  and
151              bytes of halfwords in the data.  Equivalent to -_s_S.
152              Use this option to convert 32-bit integers  between
153              big-endian and little-endian machines.
154
155       -_B     Set  the  I/O  block size to 5120 bytes.  Initially
156              the block size is 512 bytes.
157
158       --_b_l_o_c_k-_s_i_z_e=_B_L_O_C_K-_S_I_Z_E
159              Set the I/O block size to BLOCK-SIZE * 512 bytes.
160
161       -_c     Use the old portable (ASCII) archive format.
162
163       -_C _I_O-_S_I_Z_E, --_i_o-_s_i_z_e=_I_O-_S_I_Z_E
164              Set the I/O block size to IO-SIZE bytes.
165
166       -_d, --_m_a_k_e-_d_i_r_e_c_t_o_r_i_e_s
167              Create leading directories where needed.
168
169       -_E _F_I_L_E, --_p_a_t_t_e_r_n-_f_i_l_e=_F_I_L_E
170              In   copy-in   mode,   read   additional   patterns
171              specifying  filenames to extract or list from FILE.
172              The lines of FILE are treated as if they  had  been
173              non-option arguments to ccppiioo.
174
175       -_f, --_n_o_n_m_a_t_c_h_i_n_g
176              Only  copy files that do not match any of the given
177              patterns.
178
179       -_F, --_f_i_l_e=_a_r_c_h_i_v_e
180              Archive filename to use instead of  standard  input
181              or  output.  To use a tape drive on another machine
182              as the archive, use a  filename  that  starts  with
183              `HOSTNAME:'.   The  hostname  can  be preceded by a
184              username and an `@' to access the remote tape drive
185              as  that  user,  if  you  have  permission to do so
186              (typically an  entry  in  that  user's  `~/.rhosts'
187              file).
188
189       --_f_o_r_c_e-_l_o_c_a_l
190              With  -_F,  -_I, or -_O, take the archive file name to
191              be a local file even if it contains a colon,  which
192              would ordinarily indicate a remote host name.
193
194
195
196                                                                3
197
198
199
200
201
202CPIO(1L)                                                 CPIO(1L)
203
204
205       -_H _F_O_R_M_A_T, --_f_o_r_m_a_t=_F_O_R_M_A_T
206              Use  archive  format FORMAT.  The valid formats are
207              listed below; the same names are also recognized in
208              all-caps.   The  default  in  copy-in  mode  is  to
209              automatically detect the  archive  format,  and  in
210              copy-out mode is "bin".
211
212              bin    The obsolete binary format.
213
214              odc    The old (POSIX.1) portable format.
215
216              newc   The   new   (SVR4)  portable  format,  which
217                     supports file systems having more than 65536
218                     i-nodes.
219
220              crc    The   new  (SVR4)  portable  format  with  a
221                     checksum added.
222
223              tar    The old tar format.
224
225              ustar  The POSIX.1 tar format.  Also recognizes GNU
226                     ttaarr  archives,  which  are  similar  but not
227                     identical.
228
229              hpbin  The obsolete binary format  used  by  HPUX's
230                     cpio     (which    stores    device    files
231                     differently).
232
233              hpodc  The portable  format  used  by  HPUX's  cpio
234                     (which stores device files differently).
235
236       -_i, --_e_x_t_r_a_c_t
237              Run in copy-in mode.
238
239       -_I _a_r_c_h_i_v_e
240              Archive  filename to use instead of standard input.
241              To use a tape  drive  on  another  machine  as  the
242              archive,   use   a   filename   that   starts  with
243              `HOSTNAME:'.  The hostname can  be  preceded  by  a
244              username and an `@' to access the remote tape drive
245              as that user, if  you  have  permission  to  do  so
246              (typically  an  entry  in  that  user's `~/.rhosts'
247              file).
248
249       -_k     Ignored; for compatibility with other  versions  of
250              ccppiioo.
251
252       -_l, --_l_i_n_k
253              Link  files instead of copying them, when possible.
254
255       -_L, --_d_e_r_e_f_e_r_e_n_c_e
256              Dereference symbolic links  (copy  the  files  that
257              they point to instead of copying the links).
258
259
260
261
262                                                                4
263
264
265
266
267
268CPIO(1L)                                                 CPIO(1L)
269
270
271       -_m, --_p_r_e_s_e_r_v_e-_m_o_d_i_f_i_c_a_t_i_o_n-_t_i_m_e
272              Retain   previous   file  modification  times  when
273              creating files.
274
275       -_M _M_E_S_S_A_G_E, --_m_e_s_s_a_g_e=_M_E_S_S_A_G_E
276              Print MESSAGE when the  end  of  a  volume  of  the
277              backup  media  (such as a tape or a floppy disk) is
278              reached, to prompt the user to insert a new volume.
279              If MESSAGE contains the string "%d", it is replaced
280              by the current volume number (starting at 1).
281
282       -_n, --_n_u_m_e_r_i_c-_u_i_d-_g_i_d
283              In the verbose  table  of  contents  listing,  show
284              numeric  UID  and  GID  instead of translating them
285              into names.
286
287        --_n_o-_p_r_e_s_e_r_v_e-_o_w_n_e_r
288              In copy-in mode and copy-pass mode, do  not  change
289              the ownership of the files; leave them owned by the
290              user extracting them.  This is the default for non-
291              root  users,  so  that  users  on  System  V  don't
292              inadvertantly give away files.
293
294       -_o, --_c_r_e_a_t_e
295              Run in copy-out mode.
296
297       -_O _a_r_c_h_i_v_e
298              Archive filename to use instead of standard output.
299              To  use  a  tape  drive  on  another machine as the
300              archive,  use   a   filename   that   starts   with
301              `HOSTNAME:'.   The  hostname  can  be preceded by a
302              username and an `@' to access the remote tape drive
303              as  that  user,  if  you  have  permission to do so
304              (typically an  entry  in  that  user's  `~/.rhosts'
305              file).
306
307       -_p, --_p_a_s_s-_t_h_r_o_u_g_h
308              Run in copy-pass mode.
309
310       -_r, --_r_e_n_a_m_e
311              Interactively rename files.
312
313       -_R [_u_s_e_r][:.][_g_r_o_u_p], --_o_w_n_e_r [_u_s_e_r][:.][_g_r_o_u_p]
314              In  copy-out and copy-pass modes, set the ownership
315              of all files created to the specified  user  and/or
316              group.  Either the user or the group, or both, must
317              be present.  If the group is omitted but the ":" or
318              "."  separator is given, use the given user's login
319              group.   Only  the  super-user  can  change  files'
320              ownership.
321
322       -_s, --_s_w_a_p-_b_y_t_e_s
323              In  copy-in  mode,  swap the bytes of each halfword
324              (pair of bytes) in the files.
325
326
327
328                                                                5
329
330
331
332
333
334CPIO(1L)                                                 CPIO(1L)
335
336
337       -_S, --_s_w_a_p-_h_a_l_f_w_o_r_d_s
338              In copy-in mode, swap the halfwords of each word (4
339              bytes) in the files.
340
341       -_t, --_l_i_s_t
342              Print a table of contents of the input.
343
344       -_u, --_u_n_c_o_n_d_i_t_i_o_n_a_l
345              Replace   all  files,  without  asking  whether  to
346              replace existing newer files with older files.
347
348       -_v, --_v_e_r_b_o_s_e
349              List the files processed, or with -_t, give  an  `ls
350              -l'  style table of contents listing.  In a verbose
351              table of contents of  a  ustar  archive,  user  and
352              group names in the archive that do not exist on the
353              local  system  are  replaced  by  the  names   that
354              correspond  locally  to  the  numeric  UID  and GID
355              stored in the archive.
356
357       -_V --_d_o_t
358              Print a "." for each file processed.
359
360       --_v_e_r_s_i_o_n
361              Print the ccppiioo program version number and exit.
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394                                                                6
395
396
397