Skip site navigation (1)Skip section navigation (2)

FreeBSD Manual Pages


home | help
cpio(1)			    General Commands Manual		       cpio(1)

       cpio - copy file	archives in and	out; duplicate directory trees

       extarg ]


       extarg ]	directory

       The  command  saves  and	 restores  archives of files on	magnetic tape,
       other devices, or a regular file, and copies files from	one  directory
       to  another  while replicating the directory tree structure.  When com-
       pletes processing the files, it reports the number of blocks written.

       (copy out, export)
		   Read	standard input to obtain a list	 of  path  names,  and
		   copy	those files to standard	output together	with path name
		   and status information.  The	output is padded to a 512-byte

       (copy in, import)
		   Extract  files  from	standard input,	which is assumed to be
		   the result of a previous

		   If pattern..., is specified,	only the files with names that
		   match  a pattern according to the rules of Pattern Matching
		   Notation (see regexp(5)) are	selected.  A leading on	a pat-
		   tern	 indicates that	only those names that do not match the
		   remainder of	the pattern should be selected.	 Multiple pat-
		   terns  can be specified.  The patterns are additive.	 If no
		   pattern is specified, the default is	 (select  all  files).
		   See the option, as well.

		   Extracted  files  are conditionally created and copied into
		   the current directory tree, as determined  by  the  options
		   described  below.   The  permissions	of the files match the
		   permissions of the original files when the archive was cre-
		   ated	 by  unless  the option	is used.  File owner and group
		   are that of the current user	unless the user	has  appropri-
		   ate	privileges,  in	which case retains the owner and group
		   of the files	of the previous

		   Read	standard input to obtain a list	of path	names of files
		   which  are  then  conditionally created and copied into the
		   destination directory tree as determined by the options de-
		   scribed  below.   directory	must  exist.  Destination path
		   names are interpreted relative to directory.

		   With	the option, when handling a link,  only	 the  link  is
		   passed  and	no  data  blocks are actually read or written.
		   This	is especially noteworthy with where it is very	possi-
		   ble	that  all the files are	created	as links, such that no
		   blocks are written and "0 blocks" is	reported by (See below
		   for a description of	the option.)

       recognizes  the following options, which	can be appended	as appropriate
       to and Whitespace and hyphens are not permitted between	these  options
       and or

	      Reset access times of input files	after they are copied.

	      Swap both	bytes and half-words.
		      Use  only	 with See the option for details; see also the
		      and options.

	      Write or read header information in
		      ASCII character form for portability.

	      Create directories as needed.

	      Specifies	the handling of	any extent attributes of  the  file(s)
	      to be
		      archived	or  copied.  extarg takes one of the following

			Archive	or copy	the file and issue a  warning  message
			if extent attributes
				  cannot be preserved.

			Do  not	 issue	a  warning  message even if extent at-
			tributes cannot	be

			Any  file(s)  with  extent  attributes	will  not   be
			archived and a warning
				  message will be issued.

		      When  using  the	option,	extent attributes are not pre-
		      served in	the archive.  Furthermore, the option will not
		      preserve extent attributes if the	files are being	copied
		      to a file	 system	 that  does  not  support  extent  at-
		      tributes.	  If  is  not specified, the default value for
		      extarg is

	      Copy in all files	except those selected by

	      Follow symbolic links as though they were	normal files or	direc-
		      Normally,	archives the link.

	      Whenever possible, link files rather than	copying	them.
		      This  option  does not destroy existing files.  Use only

	      Retain previous file modification	time.
		      This option does not affect directories that  are	 being

	      Rename files interactively.
		      If the user types	a null line, the file is skipped.

	      Swap all bytes of	the file.
		      Use  only	 with See the option for details; see also the
		      and options.

	      Print only a table of contents of	the input.
		      No files are created, read, or copied.

	      Copy unconditionally
		      (normally, an older file does not	replace	a  newer  file
		      with the same name).

	      Print a list of file names as they are processed.
		      When used	with the option, the table of contents has the

			   numeric-mode	owner-name blocks date-time filename

		      where numeric-mode is the	 file  privileges  in  numeric
		      format, owner-name is the	name of	the file owner,	blocks
		      is the size of the file in 512-byte blocks, date-time is
		      the  date	and time the file was last modified, and file-
		      name is the path name of the file	as recorded in the ar-

	      Save or restore device special files.
		      Since  is	used to	recreate these files on	a restore, and
		      can be used only by users	 with  appropriate  privileges
		      (see mknod(2)).  This option is intended for intrasystem
		      (backup) use only.  Restoring device files from previous
		      versions	of  the	 OS,  or from different	systems	can be
		      very dangerous.  may prevent the restoration of  certain
		      device files from	the archive.

	      Suppress warning messages	regarding optional access control list
		      entries.	 does not back up optional access control list
		      entries in a file's access control  list	(see  acl(5)).
		      Normally,	 a  warning  message  is printed for each file
		      that has optional	access control list entries.

	      Block input/output at 5120 bytes to the record (does  not	 apply
		      This  option is meaningful only with data	directed to or
		      from devices that	support	variable-length	 records  such
		      as magnetic tape.

	      Have    checkpoint  itself  at  the start	of each	volume.	 If is
		      writing to a streaming tape drive	with  immediate-report
		      mode  enabled  and  a  write  error  occurs, it normally
		      aborts and exits with return code	With this option spec-
		      ified,  instead  automatically  restarts itself from the
		      checkpoint and rewrites the  current  volume.   Alterna-
		      tively,  if  is not writing to such a device and a write
		      error occurs, normally continues with the	 next  volume.
		      With this	option specified, however, the user can	choose
		      to either	ignore the error or rewrite the	 current  vol-

	      Read a file written on a
		      PDP-11  or  VAX system (with byte-swapping) that did not
		      use the option.  Use only	with Files copied in this mode
		      are  not	changed.   Non-ASCII  files are	likely to need
		      further processing to be readable.  This processing  of-
		      ten requires knowledge of	file contents, and thus	cannot
		      always be	done by	this program.  The and options can  be
		      used  when  swapping  all	 the bytes on the tape (rather
		      than just	in the headers)	is appropriate.	  In  general,
		      text  is best processed with and binary data with	one of
		      the other	options.

		      (PDP-11 and VAX are  registered  trademarks  of  Digital
		      Equipment	Corporation.)

	      Resynchronize automatically when
		      goes "out	of phase", (see	DIAGNOSTICS).

	      Swap all half-words in the file.
		      Use  only	 with See the option for details; see also the
		      and options.

	      Use the process's	file-mode creation mask	(see
		      umask(2))	to modify the mode of files  created,  in  the
		      same manner as creat(2).

	      Process a
		      UNIX Sixth-Edition-format	file.  Use only	with

       Note that archives created using	a raw device file must be read using a
       raw device file.

       When the	end of the tape	is reached, prompts the	user for a new special
       file and	continues.

       If you want to pass one or more metacharacters to without the shell ex-
       panding them, be	sure to	precede	each of	them with a backslash

       Device files written with the option (such as do	not transport to other
       implementations of HP-UX.

   Environment Variables
       determines  the	collating sequence used	in evaluating pattern matching
       notation	for file name generation.

       determines the interpretation of	text as	single and/or multi-byte char-
       acters,	and  the  characters matched by	character class	expressions in
       pattern matching	notation.

       determines the format and content of date and time strings output  when
       listing the contents of an archive with the option.

       determines the language in which	messages are displayed.

       If  or  is  not	specified  in  the  environment	or is set to the empty
       string, the value of is used as a default for each unspecified or empty
       variable.  If is	not specified or is set	to the empty string, a default
       of "C" (see lang(5)) is used instead  of	 If  any  internationalization
       variable	 contains an invalid setting, behaves as if all	international-
       ization variables are set to "C".  See environ(5).

   International Code Set Support
       Single- and multi-byte character	code sets are supported.

       returns the following exit codes:

	      Successful completion.
		     Review standard error for files that could	not be	trans-

	      Error during resynchronization.
		     Some files	may not	have been recovered.

	      Out-of-phase error.
		     A file header is corrupt or in the	wrong format.

		     could not read the	header of an archived file.
	      The  header  is corrupt or it was	written	in a different format.
	      Without the option, returns an exit code of

	      If no file name has been displayed yet, the problem may  be  the
	      format.	Try  specifying	a different header format option: null
	      for standard format; for ASCII; or for one of the	 byte-swapping
	      formats; or for UNIX Sixth Edition.

	      Otherwise,  a header may be corrupt.  Use	the option to have at-
	      tempt to resynchronize the file automatically.   Resynchronizing
	      means  that  tries  to  find the next good header	in the archive
	      file and continues processing from there.	 If  tries  to	resyn-
	      chronize from being out of phase,	it returns an exit code	of

       Other diagnostic	messages are self-explanatory.

       Copy the	contents of a directory	into a tape archive:

       Duplicate a directory hierarchy:

       The trivial case

       can be handled more efficiently by:

       Because of industry standards and interoperability goals, does not sup-
       port the	 archival  of  files  larger  than  2GB	 or  files  that  have
       user/group  IDs	greater	 than  60K.  Files with	user/group IDs greater
       than 60K	are archived and restored under	the user/group ID of the  cur-
       rent process.

       Do  not	redirect the output of to a named archive file residing	in the
       same directory as the original files belonging to that  archive.	  This
       can cause loss of data.

       strips any leading characters in	the list of filenames piped to it.

       Path  names are restricted to characters	(see and limits(5)).  If there
       are too many unique linked files, the program runs  out	of  memory  to
       keep  track  of	them.	Thereafter, linking information	is lost.  Only
       users with appropriate privileges can copy special files.

       tapes written on	HP machines with the  options  can  sometimes  mislead
       (non-HP)	 versions  of that do not support the option.  If a non-HP (or
       non-AT&T) version of happens to be modified so that the (HP) recognizes
       it as a device special file, a spurious device file might be created.

       If is not accessible, issues a complaint	and exits.

       The option does not create the directory	typed on the command line.

       The option does not make	empty directories.

       The option does not link	files to existing files.

       POSIX  defines a	file named as an end-of-archive	marker.	 Consequently,
       if a file of that name is contained in a	group of files	being  written
       by  the	file  is interpreted as	end-of-archive,	and no remaining files
       are copied.  The	recommended practice is	to avoid naming	files anything
       that resembles an end-of-archive	file name.

       To create a POSIX-conforming archive, the option	must be	used.  To read
       a POSIX-conforming archive, the option must be used and the and options
       should  not be used.  If	the user does not have appropriate privileges,
       the option must also be used  to	 get  POSIX-conforming	behavior  when
       reading	an  archive.  Users with appropriate privileges	should not use
       this option to get POSIX-conforming behavior.

       If the path given to contains a symbolic	link as	the last element, this
       link is traversed and pathname resolution continues.  uses the symbolic
       link's target, rather than that of the link.

       ar(1), find(1), tar(1),	cpio(4),  acl(5),  environ(5),	lang(5),  reg-



Want to link to this manual page? Use this URL:

home | help