SCPIO(1L)

πŸ“¦
version 2024.03.21 Β· 2 versions
, in fedora 44, opensuse-leap 16.0

πŸ’– SCPIO(1L) πŸ’–

okay bestie, welcome to the scpio page from SchilyΒ΄s USER COMMANDS! this is the LEGACY girlie and she's here to copy file archives in and out. let's get into it. πŸ’…


πŸŽ€ NAME πŸŽ€

scpio β€” copy file archives in and out (LEGACY)

✨ SYNOPSIS ✨

scpio [ other options ] -o[aBcv]
scpio [ other options ] -i[Bcdmruvf] [ pattern ...  ]
scpio [ other options ] -it[Bcvf] [ pattern ...  ]
scpio [ other options ] -p[adlmuv] directory

🌸 DESCRIPTION 🌸

The scpio utility, depending on the options used:

  • copies files to an archive file
  • extracts files from an archive file
  • lists files from an archive file
  • copies files from one directory tree to another.

πŸ’… OPTIONS πŸ’…

The scpio utility supports the XBD specification Utility Syntax Guidelines. The cpio standard does not allow the option modifiers to be presented as separate arguments from the option letters. The scpio implementation allows option modifiers to be presented as separate arguments from the option letters. When writing portable shell scripts do never make use of this feature.

bestie, that's a portability warning, fr fr. do not use that glow-up in scripts that need to travel. 😭

The following options are supported:

  • -o β€” (Copy Out.) Read the standard input to obtain a list of pathnames and copy those files onto the standard output together with pathname and status information. Output is padded to a 512-byte boundary.
  • -i β€” (Copy In.) Extract files from the standard input, which is assumed to be the product of a previous scpio -o. Only files with names that match patterns are selected. The extracted files are conditionally created and copied into the current directory tree based upon the options described below. The permissions of the files will be those of the previous scpio -o. The owner and group of the files will be that of the current user unless the user has appropriate privileges, which causes scpio to retain the owner and group of the files of the previous scpio -o. If the archive being read does not match the modifier specified, scpio may consider this to be an error and exit or may recognise the archive and continue processing. Only a user with appropriate privileges can extract block special or character special files from an archive.
  • -it β€” (List.) List files from the archive. This is a sub mode of the copy in mode, no files are created in list mode.
  • -p β€” (Pass.) Read the standard input to obtain a list of pathnames of files that are conditionally created and copied into the destination directory tree based upon the option modifiers described below.

The following option modifiers can be appended in any sequence to the -o, -i or -p options:

  • a β€” Reset access times of input files after they have been copied. (When option l (see below) is also specified, the access times of the linked files are not reset.)
  • B β€” Block input/output 5120 bytes to the record (does not apply to the -p option; meaningful only with data directed to or from character special files).
  • d β€” Create directories as needed.
  • c β€” Write or read header information in character form for portability. Note that the Open Group standard does not specify the archive format that should be used with the c option. For this reason it is questionable whether the c option increases portability in general.

The archive format used by scpio with the c option is the format from the -H asc option. It gives best cpio compatibility when transferring files to SVR4-based systems (except that the file size is limited to 2 gigabytes). When transferring files in cpio archives to unknown operating systems, it is unwise to use the c option.

  • r β€” Interactively rename files. For each archive member matching pattern operand, a prompt will be written to the file /dev/tty. The prompt will contain the name of the archive member, but the format is otherwise unspecified. A line will then be read from /dev/tty. If this line is blank, the archive member will be skipped. If this line consists of a single period, the archive member will be processed with no modification to its name. Otherwise, its name will be replaced with the contents of the line. The scpio utility will immediately exit with a non-zero exit status if end-of-file is encountered when reading a response, or if /dev/tty cannot be opened for reading and writing.
  • t β€” Write a table of contents of the input. No files are created.
  • u β€” Copy unconditionally (normally, an older file will not replace a newer file with the same name).
  • v β€” Verbose: print the names of the affected files. With the t option, provides a detailed listing.
  • l β€” Whenever possible, link files rather than copying them. Usable only with the -p option. The l option modifier is not yet supported by scpio.
  • m β€” Retain previous file modification time. This option is ineffective on directories that are being copied.
  • f β€” Copy in all files except those in patterns.

The following other options are implemented as SVr4 compliant extension to the Open Group standard:

  • -6 β€” Extract UNIX System Sixth Edition cpio archives. This option is not valid in archive create mode, it is mutually exclusive with -c, -H, and artype=. As is is unclear how UNIX System Sixth Edition cpio archives look like, this option is currently unsupported.
  • -@ β€” Include extended file attributes in the archive. This option is currently unsupported.
  • -A β€” Append files to an existing archive. The -A option only works together with the -O option. See star -r for more information.
  • -b β€” Reverses the order of the bytes within each word. It is unclear what a word is supposed to be. This option is unsupported but not needed as scpio includes automatic byte order recognition.
  • -C # β€” Sets (input/output) archive block size to # bytes.
  • -E name β€” Read filenames for store/create/list command from name. The file name must contain a list of filenames, each on a separate line.
  • -H header β€” Set the archive type to header. See star(1) for more information.
  • -I nm β€” Use nm as archive file name instead of stdin.
  • -k β€” Try to skip corrupt archive headers.
  • -L β€” Follow symbolic links as if they were files.
  • -M message β€” Define a message that is uses when switching media. This option is currently unsupported.
  • -O nm β€” Use nm as archive file name instead of stdout.
  • -P β€” Handle Access Control List (ACL) information in create and extract mode. See star -acl for more information.
  • -R nm β€” Reassign ownership and group for all files based on nm. This option is currently unsupported.
  • -s β€” Reverses the order of the bytes within each word. It is unclear what a word is supposed to be. This option is unsupported but not needed as scpio includes automatic byte order recognition.
  • -S β€” Reverses the order of the halfwords within each word. It is unclear what a word is supposed to be. This option is unsupported but not needed as scpio includes automatic byte order recognition.
  • -V β€” Special verbose. Print a dot for each file that is read or written. This option is currently unsupported.

The following other options are implemented as star extension to the Open Group standard:

  • -help β€” Prints a summary of the most important options for scpio(1) and exits.
  • -xhelp β€” Prints a summary of the less important options for scpio(1) and exits.
  • -version β€” Prints the scpio version number string and exists.
  • -/ β€” Don't strip leading slashes from file names when extracting an archive. See star(1) for more information.
  • .. β€” Don't skip files that contain /../ in the name. See star(1) for more information.
  • -7z β€” run the input or output through a p7zip pipe - see option -z below.

Note that the p7zip program currently does not operate on a pipe but on a /tmp file copy and thus limits the maximum archive size.

  • -acl β€” Handle Access Control List (ACL) information in create and extract mode. See star(1) for more information.
  • artype=header β€” Set the archive type to header. See star(1) for more information.
  • -lzo β€” Run the input or output through a lzop pipe - see option -z below.
  • -bz β€” Run the input or output through a bzip2 pipe - see option -z below. As the -bz the -z options are non standard, it makes sense to omit -bz options the inside shell scripts. If you are going to extract a compressed archive that is located inside a plain file, scpio will auto detect compression and choose the right decompression option to extract.
  • bs=# β€” Set block size to #. You may use the same method as in dd(1) and sdd(1). See star(1) for more information.
  • -fifostats β€” Print fifo statistics at the end of a scpio run when the fifo has been in effect.
  • fs=# β€” Set fifo size to #. See star(1) for more information.
  • -no-fifo β€” Do not use a fifo to optimize data flow from/to tape. See star(1) for more information.
  • -no-fsync β€” Do not call fsync(2) for each file that has been extracted from the archive. See star(1) for more information.
  • -do-fsync β€” Call fsync(2) for each file that has been extracted from the archive. See star(1) for more information.
  • -no-statistics β€” Do not print statistic messages at the end of a scpio run.
  • -secure-links β€” Do not extract hard links or symbolic links if the link name (the target of the link) starts with a slash (/) or if /../ is contained in the link name. See star(1) for more information.
  • -numeric β€” Use the numeric user/group fields in the listing rather than the default. See star(1) for more information.
  • -time β€” Print timing info. See star(1) for more information.
  • -xfflags β€” Store and extract extended file flags as found on BSD and Linux systems. See star -acl for more information.
  • -z β€” Run the input or output through a gzip pipe - see option -bz above. As the -bz the -z options are non standard, it makes sense to omit -bz options the inside shell scripts. If you are going to extract a compressed archive that is located inside a plain file, scpio will auto detect compression and choose the right decompression option to extract.
  • -zstd β€” run the input or output through a zstd pipe - see option -z above.

πŸŽ€ OPERANDS πŸŽ€

Okay bestie, here's the cast of characters you can actually hand to scpio:

  • directory β€” a pathname of a directory that already exists, and it's gonna be the target of scpio -p. Like, it has to be there already, we're not building it for you πŸ’…
  • pattern β€” expressions that use a pattern-matching notation kinda like what the shell does for filename pattern matching, and also kinda like regular expressions. Here are the metacharacters, periodt:
    • * β€” matches any string, even the empty string (yes, empty, it's giving generous ✨)
    • ? β€” matches any single character
    • [...] β€” matches any one of the characters inside the brackets. A pair of characters separated by - matches any symbol between that pair, inclusive, as defined by the system default collating sequence. And heads up: if the first character after the opening [ is a !, the results are unspecified 😭 (so maybe don't)

Inside pattern, the special characters ?, * and [ also match the / character. You can specify multiple cases of pattern, and if you don't specify any pattern at all, the default is * β€” meaning select all files, we love a "select everything" moment πŸ‘‘

Lowkey important note: scpio does not use fnmatch(3) based pattern matching like the stuff documented above. It uses the pattern matcher documented in match(1) instead. So like, read that one too, bestie 🫢

πŸ“₯ STDIN πŸ“₯

  • When the -o or -p options are used, standard input is a text file with a list of pathnames, one per line, that are gonna be copied.
  • When the -i option is used, standard input is an archive file formatted in any way the archive handling engine understands (peep the -H help option for the full list, iykyk).

πŸ—‚οΈ INPUT FILES πŸ—‚οΈ

The files identified by the pathnames on standard input can be of any type. No discrimination here, we accept everyone 🌈

When the -r option is used, the file /dev/tty is used to write prompts and read responses. So it's literally talking directly to your terminal, main character energy fr.


⚑ ASYNCHRONOUS EVENTS ⚑

Default. That's it. That's the whole section. Slay πŸ’…


πŸ“€ STDOUT πŸ“€

When the -o option is used, standard output is an archive file formatted as specified by pax with the -x cpio option. And because we want better compatibility with SVR4-based systems that don't implement the cpio format correctly, scpio by default limits the length of file names to 256 bytes. If you want the full thing, use scpio -H cpio to explicitly switch to the full POSIX 1003.1-1988 cpio archive format πŸ‘‘

Otherwise (i.e. not -o), standard output contains commentary in an unspecified format concerning the progress of the execution. Vague on purpose, we love a mystery πŸ¦‹


🚨 STDERR 🚨

When the -o option is not used, standard error contains commentary in an unspecified format concerning the progress of the execution.

Otherwise, standard error is used only for diagnostic messages. So when -o is on, stderr is strictly for "something went wrong" energy 😭


πŸ’Ύ OUTPUT FILES πŸ’Ύ

Output files get created, as specified by the archive, when the -i or -p options are used. That's the whole vibe ✨


🏁 EXIT STATUS 🏁

Here's what you get back:

  • 0 β€” successful completion, we ate πŸ’–
  • >0 β€” an error occurred πŸ’€

🫠 CONSEQUENCES OF ERRORS 🫠

If a file or directory can't be created or overwritten, scpio just continues with the next file in the archive, or the next file to be added to the archive. No dramatic exit, it just keeps it moving, resilient queen πŸ‘‘


🧠 APPLICATION USAGE 🧠

Archives created by scpio are portable between XSI-conformant systems, provided the same procedures are used. Same recipe, same result, no cap.

The shell metacharacter notation is not fully compatible with the notation used by the shell and the pax utility. Also, not all systems support the negation character [! ...] in cpio patterns β€” so portable applications must avoid using this notation. Like, just don't, bestie πŸ™ˆ

For portable communication of data between XSI-conformant systems, the recommendation is:

  • only use characters defined in the ISO/IEC 646:1991 standard International Reference Version (equivalent to ASCII) 7-bit range of characters
  • and only use characters defined in the Portable Filename Character Set for naming files

This recommendation exists because XSI-conformant systems support diverse codesets and run in various geographical areas, and there's no single, well-established codeset that incorporates all the characters of the languages of those various geographical areas. Basically, everyone's speaking a different language and we need a lingua franca 🌍

⚠️ The cpio archive format only supports file sizes up to 8 gigabytes. That's the ceiling, babe.

Applications should migrate to the pax archive format, which is the POSIX 1003.1-2001 standard archive format and is based on an extended tar format. Future-proof yourself ✨


🌟 EXAMPLES 🌟

  1. Copy the contents of a directory onto an archive:
ls | scpio -o >../cpio.out
  1. Duplicate a directory hierarchy:
cd olddir
find . -depth -print | scpio -pd ../newdir

🌸 ENVIRONMENT 🌸

These environment variables can affect how scpio runs:

  • TZ β€” determines the timezone used with date and time strings. (Yes, timezones are the drama, always πŸ•)

πŸ‘€ SEE ALSO πŸ‘€

ar(1), find(1), sfind(1), ls(1), match(1), pax(1), spax(1), tar(1), star(1).

Go read those too, they're all part of the friend group 🫢


πŸ“ NOTES πŸ“

The default block size for cpio is 512 bytes, and this slows down write speed. So use -B, -C, or bs= to set a different block size. Speed it up, bestie 🏎️

Scpio -iu is equivalent to star -xU -install -force-remove -remove-recursive, and for this reason it may remove nonempty directory trees in extrace mode without printing a warning. That's a whole lot of destructive power with zero heads-up. Be careful, fr fr πŸ’€

The Open Group has given us permission to reprint portions of their documentation. In the following statement, the phrase ``this text'' refers to portions of the system documentation.

Portions of this text are reprinted and reproduced in electronic form in the scpio manual, from The Open Group Base Specifications Issue 5, Copyright (C) 1997 by The Open Group. In the event of any discrepancy between these versions and the original specification, the original The Open Group Standard is the referee document. The original Standard can be obtained online at http://www.opengroup.org/unix/single_unix_specification_v2.

(Yes we have to say all that. Legal said so. πŸ’…)


πŸ› BUGS πŸ›

None currently known. Iconic behaviour honestly 😌✨

Mail bugs and suggestions to schilytools@mlists.in-berlin.de or open a ticket at https://codeberg.org/schilytools/schilytools/issues.

The mailing list archive may be found at:

https://mlists.in-berlin.de/mailman/listinfo/schilytools-mlists.in-berlin.de


πŸ‘‘ AUTHORS πŸ‘‘

Joerg Schilling and the schilytools project authors. Legends, honestly 🫢


πŸ“¦ SOURCE DOWNLOAD πŸ“¦

The source code for scpio is included in the schilytools project and may be retrieved from the schilytools project at Codeberg at:

https://codeberg.org/schilytools/schilytools

The download directory is:

https://codeberg.org/schilytools/schilytools/releases


And that's the whole page, bestie πŸ’– This was SCPIO(1L) by Joerg Schilling, dated 2022/08/17, straight out of the schilytools project. Go forth and archive responsibly, mwah πŸŽ€βœ¨

πŸ“¦ where this page comes from