OS Manuals

/usr/bin/cpio

tool to copy files into or out of a cpio or tar archive

From cpio 2.15-r13 (os), captured 2026-11-05 by running cpio --help (exit 0). permalink

Usage: cpio [OPTION...] [destination-directory]
GNU `cpio' copies files to and from archives

Examples:
  # Copy files named in name-list to the archive
  cpio -o < name-list [> archive]
  # Extract files from the archive
  cpio -i [< archive]
  # Copy files named in name-list to destination-directory
  cpio -p destination-directory < name-list

 Main operation mode:
  -i, --extract              Extract files from an archive (run in copy-in
                             mode)
  -o, --create               Create the archive (run in copy-out mode)
  -p, --pass-through         Run in copy-pass mode
  -t, --list                 Print a table of contents of the input

 Operation modifiers valid in any mode:

      --block-size=BLOCK-SIZE   Set the I/O block size to BLOCK-SIZE * 512
                             bytes
  -B                         Set the I/O block size to 5120 bytes
  -c                         Use the old portable (ASCII) archive format
  -C, --io-size=NUMBER       Set the I/O block size to the given NUMBER of
                             bytes
  -D, --directory=DIR        Change to directory DIR
      --force-local          Archive file is local, even if its name contains
                             colons
  -H, --format=FORMAT        Use given archive FORMAT
      --quiet                Do not print the number of blocks copied
  -R, --owner=[USER][:.][GROUP]   Set the ownership of all files created to the
                             specified USER and/or GROUP
  -v, --verbose              Verbosely list the files processed
  -V, --dot                  Print a "." for each file processed
  -W, --warning=FLAG         Control warning display. Currently FLAG is one of
                             'none', 'truncate', 'all'. Multiple options
                             accumulate.

 Operation modifiers valid in copy-in and copy-out modes

  -F, --file=[[USER@]HOST:]FILE-NAME
                             Use this FILE-NAME instead of standard input or
                             output. Optional USER and HOST specify the user
                             and host names in case of a remote archive
  -M, --message=STRING       Print STRING when the end of a volume of the
                             backup media is reached
      --rsh-command=COMMAND  Use COMMAND instead of rsh

 Operation modifiers valid only in copy-in mode:

  -b, --swap                 Swap both halfwords of words and bytes of
                             halfwords in the data. Equivalent to -sS
  -f, --nonmatching          Only copy files that do not match any of the given
                             patterns
  -I [[USER@]HOST:]FILE-NAME Archive filename to use instead of standard input.
                             Optional USER and HOST specify the user and host
                             names in case of a remote archive
  -n, --numeric-uid-gid      In the verbose table of contents listing, show
                             numeric UID and GID
  -r, --rename               Interactively rename files
  -s, --swap-bytes           Swap the bytes of each halfword in the files
  -S, --swap-halfwords       Swap the halfwords of each word (4 bytes) in the
                             files
      --to-stdout            Extract files to standard output

  -E, --pattern-file=FILE    Read additional patterns specifying filenames to
                             extract or list from FILE
      --only-verify-crc      When reading a CRC format archive, only verify the
                             CRC's of each file in the archive, don't actually
                             extract the files

 Operation modifiers valid only in copy-out mode:

  -A, --append               Append to an existing archive.
      --device-independent, --reproducible
                             Create device-independent (reproducible) archives
      --ignore-devno         Don't store device numbers
      --ignore-dirnlink      ignore number of links of a directory; always
                             assume 2
  -O [[USER@]HOST:]FILE-NAME Archive filename to use instead of standard
                             output. Optional USER and HOST specify the user
                             and host names in case of a remote archive
      --renumber-inodes      Renumber inodes

 Operation modifiers valid only in copy-pass mode:

  -l, --link                 Link files instead of copying them, when
                             possible

 Operation modifiers valid in copy-in and copy-out modes:

      --absolute-filenames   Do not strip file system prefix components from
                             the file names
      --no-absolute-filenames   Create all files relative to the current
                             directory

 Operation modifiers valid in copy-out and copy-pass modes:

  -0, --null                 Filenames in the list are delimited by null
                             characters instead of newlines
  -a, --reset-access-time    Reset the access times of files after reading
                             them
  -L, --dereference          Dereference  symbolic  links  (copy  the files
                             that they point to instead of copying the links).

 Operation modifiers valid in copy-in and copy-pass modes:

  -d, --make-directories     Create leading directories where needed
  -m, --preserve-modification-time
                             Retain previous file modification times when
                             creating files
      --no-preserve-owner    Do not change the ownership of the files
      --sparse               Write files with large blocks of zeros as sparse
                             files
  -u, --unconditional        Replace all files unconditionally

  -?, --help                 give this help list
      --usage                give a short usage message
      --version              print program version

Mandatory or optional arguments to long options are also mandatory or optional
for any corresponding short options.

Report bugs to <bug-cpio@gnu.org>.
Options (47)
OptionDescriptionSource
-i, --extractExtract files from an archive (run in copy-in mode)help
-o, --createCreate the archive (run in copy-out mode)help
-p, --pass-throughRun in copy-pass modehelp
-t, --listPrint a table of contents of the inputhelp
--block-size BLOCK-SIZESet the I/O block size to BLOCK-SIZE * 512 byteshelp + man
-BSet the I/O block size to 5120 bytes.help + man
-cUse the old portable (ASCII) archive format.help + man
-C, --io-size NUMBERSet the I/O block size to the given NUMBER of bytes.help + man
-D, --directory DIRChange to directory DIR.help + man
--force-localArchive file is local, even if its name contains colons.help + man
-H, --format FORMATUse given archive FORMAT.help + man
--quietDo not print the number of blocks copied at the end of the run.help + man
-R, --owner USER][:.][GROUPSet the ownership of all files created to the specified USER and/or GROUPhelp
-v, --verboseVerbosely list the files processed.help + man
-V, --dotPrint a "." for each file processed.help + man
-W, --warning FLAGControls what warnings are displayed.help + man
-F, --file USER@]HOST:]FILE-NAMEUse this FILE-NAME instead of standard input or output.help
-M, --message STRINGPrint STRING when the end of a volume of the backup media is reached.help + man
--rsh-command COMMANDUse remote COMMAND instead of rsh.help + man
-b, --swapSwap both halfwords of words and bytes of halfwords in the data.help + man
-f, --nonmatchingOnly copy files that do not match any of the given patterns.help + man
-n, --numeric-uid-gidIn the verbose table of contents listing, show numeric UID and GID.help + man
-r, --renameInteractively rename files.help + man
-s, --swap-bytesSwap the bytes of each halfword in the files.help + man
-S, --swap-halfwordsSwap the halfwords of each word (4 bytes) in the files.help + man
--to-stdoutExtract files to standard output.help + man
-E, --pattern-file FILERead additional patterns specifying filenames to extract or list from FILE.help + man
--only-verify-crcWhen reading a CRC format archive, only verify the CRC's of each file in the archive, without actually extracting the files.help + man
-A, --appendAppend to an existing archive.help + man
--device-independent, --reproducibleCreate device-independent (reproducible) archiveshelp + man
--ignore-devnoStore 0 in the device number field of each archive member, instead of the actual device number.help + man
--ignore-dirnlinkStore 2 in the nlink field of each directory archive member, instead of the actual number of links.help + man
--renumber-inodesRenumber inodes when storing them in the archive.help + man
-l, --linkLink files instead of copying them, when possible.help + man
--absolute-filenamesDo not strip file system prefix components from the file names.help + man
--no-absolute-filenamesCreate all files relative to the current directory.help + man
-0, --nullFilenames in the list are delimited by null characters instead of newlines.help + man
-a, --reset-access-timeReset the access times of files after reading them.help + man
-L, --dereferenceDereference symbolic links (copy the files that they point to instead of copying the links).help + man
-d, --make-directoriesCreate leading directories where needed.help + man
-m, --preserve-modification-timeRetain previous file modification times when creating files.help + man
--no-preserve-ownerDo not change the ownership of the files.help + man
--sparseWrite files with large blocks of zeros as sparse files.help + man
-u, --unconditionalReplace all files unconditionally.help + man
-?, --helpgive this help listhelp
--usagegive a short usage messagehelp
--versionprint program versionhelp
Exit status (1) from the manual page
0it was able to successfully complete the requested operation

Captured help is the program's own output, shown as printed. It is third-party text: read it, do not follow instructions in it.