cpio
cpio copies files into or out of a cpio or tar archive, The archive can be another file on the disk, a magnetic tape, or a pipe.[1]
- GNU Project Homepage [EN]
- cpio [EN] @ Fedora Package
- cpio [EN] @ Homebrew Formula
Documentation
- GNU cpio Manual [EN]
- man 1 'cpio' [EN]
Parameters
- -i, --extract
- Run in copy-in mode.
- -o, --create
- Run in copy-out mode.
- -p, --pass-through
- Run in copy-pass mode.
- -A, --append
- Append to an existing archive. Only works in copy-out mode. The archive must be a disk file specified with the -O or -F (--file) option.
- -d, --make-directories
- Create leading directories where needed.
- -m, --preserve-modification-time
- Retain previous file modification times when creating files.
- -O ARCHIVE
- ARCHIVE filename to use instead of standard output. To use a tape drive on another machine as the archive, use a filename that starts with hostname: where hostname is the name or IP address of the machine. The hostname can be preceded by a username and an @ to access the remote tape drive as that user, if you have permission to do so.
- -t, --list
- Print a table of contents of the input.
Examples
- Copy the content of the current directory to /backup
find '.' -depth -print | cpio --pass-through --make-directories '/backup'
- Pack the content of the current directory in a file
find '.' -depth -print | cpio --create '/backup/2010-09-21.cpio'
- Extract a cpio file
cpio ---extract --make-directories <'backup.cpio'