CPIO(1)

๐Ÿ’ซ CPIO(1) โ€” the GNU CPIO era ๐Ÿ’ซ

okay bestie, so this is the GNU CPIO manual page and honestly? it's a whole vibe. cpio copies files to and from archives, and once you get it, you get it. iykyk ๐ŸŽ€


โœจ NAME โœจ

cpio โ€” copy files to and from archives ๐Ÿฆ‹


โœจ SYNOPSIS โœจ

cpio {-o|--create} [-0acvABLV] [-C BYTES] [-H FORMAT] [-M MESSAGE] [-O
[[USER@]HOST:]ARCHIVE] [-F [[USER@]HOST:]ARCHIVE]
[--file=[[USER@]HOST:]ARCHIVE] [--format=FORMAT] [--message=MESSAGE]
[--null] [--reset-access-time] [--verbose] [--dot] [--append]
[--block-size=blocks] [--dereference] [--io-size=BYTES] [--quiet]
[--force-local] [--rsh-command=COMMAND] < name-list [> archive]

cpio {-i|--extract} [-bcdfmnrtsuvBSV] [-C BYTES] [-E FILE] [-H FORMAT]
[-M MESSAGE] [-R [USER][:.][GROUP]] [-I [[USER@]HOST:]ARCHIVE] [-F
[[USER@]HOST:]ARCHIVE] [--file=[[USER@]HOST:]ARCHIVE]
[--make-directories] [--nonmatching] [--preserve-modification-time]
[--numeric-uid-gid] [--rename] [--list] [--swap-bytes] [--swap] [--dot]
[--unconditional] [--verbose] [--block-size=BLOCKS] [--swap-halfwords]
[--io-size=BYTES] [--pattern-file=FILE] [--format=FORMAT]
[--owner=[USER][:.][GROUP]] [--no-preserve-owner] [--message=MESSAGE]
[--force-local] [--no-absolute-filenames] [--sparse] [--only-verify-crc]
[--to-stdout] [--quiet] [--rsh-command=COMMAND] [pattern...] [< archive]

cpio {-p|--pass-through} [-0adlmuvLV] [-R [USER][:.][GROUP]] [--null]
[--reset-access-time] [--make-directories] [--link] [--quiet]
[--preserve-modification-time] [--unconditional] [--verbose] [--dot]
[--dereference] [--owner=[USER][:.][GROUP]] [--no-preserve-owner]
[--sparse] destination-directory < name-list

cpio {-?|--help|--usage|--version}

like, four whole modes, pick your fighter ๐Ÿ’…


โš ๏ธ NOTE โš ๏ธ

bestie this manpage is literally just the short version of GNU cpio. for the full tea โ€” examples, usage recommendations, all of it โ€” go read the GNU Cpio Manual in texinfo format. if the info reader and the cpio docs are properly installed on your system, this command:

info cpio

should give you access to the complete manual. ๐Ÿซถ

you can also view the manual using the info mode in emacs(1), or find it in various formats online at:

http://www.gnu.org/software/cpio/manual
if any discrepancies occur between this manpage and the GNU Cpio Manual, the later shall be considered the authoritative source. no cap, the manual wins. ๐Ÿ’€

๐ŸŒธ DESCRIPTION ๐ŸŒธ

GNU cpio copies files between archives and directories. it supports these archive formats, and yes it's giving range: old binary cpio, old portable cpio, SVR4 cpio with and without checksum, HP cpio, and various tar formats. iconic behavior honestly. ๐Ÿ‘‘

the operation mode is requested by one of the following options:

  • -o, --create โ€” Copy-out. read a list of file names from the standard input and create on the standard output (unless overridden by the --file option) an archive containing these files. main character energy: it's making the archive โœจ
  • -i, --extract โ€” Copy-in. read the archive from standard input (or from the file supplied with the --file option) and extract files from it, or (if the -t option is given) list its contents to the standard output. if one or more patterns are supplied, read or list only files matching these patterns. and psst โ€” the -t option alone implies -i. ๐ŸŽ€
  • -p, --pass-through โ€” Pass-through. read a list of file names from the standard input and copy them to the specified directory. no archive, just vibes and files moving. ๐Ÿฆ‹
  • -?, --help โ€” give a short help summary and exit. a little snack of information ๐Ÿ“
  • --usage โ€” print a short usage message and exit.
  • --version โ€” print program version and exit.

๐Ÿ’– OPTIONS ๐Ÿ’–

๐Ÿงš 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. this is the same as -H odc.
  • -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. local is local, periodt.
  • -H, --format=FORMAT โ€” use given archive FORMAT. valid formats are (the number in parentheses gives maximum size for individual archive member):
    • bin โ€” the obsolete binary format. (2147483647 bytes)
    • odc โ€” the old (POSIX.1) portable format. (8589934591 bytes)
    • newc โ€” the new (SVR4) portable format, which supports file systems having more than 65536 inodes. (4294967295 bytes)
    • crc โ€” the new (SVR4) portable format with a checksum added.
    • tar โ€” the old tar format. (8589934591 bytes)
    • ustar โ€” the POSIX.1 tar format. also recognizes GNU tar archives, which are similar but not identical. (8589934591 bytes)
    • hpbin โ€” the obsolete binary format used by HPUX's cpio (which stores device files differently).
    • hpodc โ€” the portable format used by HPUX's cpio (which stores device files differently).
  • -R, --owner=[USER][:.][GROUP] โ€” in copy-in and copy-pass mode, set the ownership of all files created to the specified USER and/or GROUP. in copy-out mode, store the supplied owner information in the archive. USER and GROUP are first looked up in the system user and group databases. if not found, cpio checks if they consist of decimal digits only and, if so, treats them as numeric UID and GID, correspondingly. to avoid the lookup and ensure that arguments are treated as numeric values, prefix them with a plus sign, e.g.: -R +0:+0. ๐Ÿ’…
  • --quiet โ€” do not print the number of blocks copied at the end of the run. shhh ๐Ÿคซ
  • --rsh-command=COMMAND โ€” use remote COMMAND instead of rsh.
  • -v, --verbose โ€” verbosely list the files processed.
  • -V, --dot โ€” print a "." for each file processed.
  • -W, --warning=FLAG โ€” controls what warnings are displayed. the FLAG is one of none, to disable all warnings, all to enable them, truncate, to enable warnings about field truncation, and no-truncate, to disable them. multiple -W options accumulate. ๐Ÿซถ

๐Ÿฆ‹ Operation modifiers valid in copy-in and copy-out modes

  • -F, --file=[[USER@]HOST:]ARCHIVE-FILE โ€” use this ARCHIVE-FILE instead of standard input (in copy-in mode) or standard output (in copy-out mode). 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. a little heads-up note ๐Ÿ“

โญ 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. the contrarian option, we love her ๐Ÿ™ˆ
  • -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, without actually extracting the files. look, don't touch. ๐Ÿ‘€

๐Ÿ”ฅ Operation modifiers valid only in copy-out mode

  • -A, --append โ€” append to an existing archive.
  • --device-independent, --reproducible โ€” create reproducible archives. this is equivalent to --ignore-devno --ignore-dirnlink --renumber-inodes.
  • --ignore-devno โ€” store 0 in the device number field of each archive member, instead of the actual device number.
  • --ignore-dirnlink โ€” store 2 in the nlink field of each directory archive member, instead of the actual number of links.
  • -O [[USER@]HOST:]ARCHIVE-NAME โ€” use ARCHIVE-NAME instead of standard output. optional USER and HOST specify the user and host names in case of a remote archive. the output archive name can be specified either using this option, or using -F (--file), but not both. pick one bestie, no double-dipping ๐Ÿ’€
  • --renumber-inodes โ€” renumber inodes when storing them in the archive.

๐ŸŽ€ 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. this is the default.
  • --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.
  • -I [[USER@]HOST:]ARCHIVE-NAME โ€” use ARCHIVE-NAME instead of standard input. optional USER and HOST specify the user and host names in case of a remote archive. the input archive name can be specified either using this option, or using -F (--file), but not both. again โ€” one or the other, not both, i'm serious ๐Ÿ˜ญ
  • -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. absolutely feral, no questions asked ๐Ÿ”ฅ

๐ŸŒŸ RETURN VALUE ๐ŸŒŸ

GNU cpio exits with code 0 if it was able to successfully complete the requested operation. on errors, it exits with code 2. slay on success, 2 when it's giving chaos. โœจ


๐Ÿ‘€ SEE ALSO ๐Ÿ‘€

tar(1), rmt(8), mt(1). the whole friend group ๐Ÿซถ


๐Ÿ› BUG REPORTS ๐Ÿ›

report bugs to <bug-cpio@gnu.org>. tell them everything bestie, they want to know ๐Ÿ’Œ


Copyright ยฉ 2014--2023 Free Software Foundation, Inc. License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html> This is free software: you are free to change and redistribute it. There is NO WARRANTY, to the extent permitted by law.

fr fr, free software means free to change and share โ€” but no warranty, so don't come for them if it goes sideways ๐Ÿ’€

and that's the whole page diva ๐Ÿ’… โ€” this little love letter came from GNU CPIO, dated April 29, 2023, and it's out. go archive something iconic. ๐Ÿฆ‹โœจ๐ŸŽ€

๐Ÿ“ฆ where this page comes from