cpio Linux Commands

What is Linux cpio Command?

Explanation

cpio COMMAND:

cpio command creates and un-creates archived cpio files. It is capable of copying files to things other than a hard disk. Probably, this command is also used to backup and restore files.

SYNTAX :


cpio [options]

OPTIONS:


-i Extracts files from the standard input.
-o Reads the standard input to obtain a list of path names and copies those files onto the standard output.
-p Reads the standard input to obtain a list of path names of files.
-c Read or write header information in ASCII character form for portability.
-d Creates directories as needed.
-u Copy unconditionally (normally, an older file will not replace a newer file with the same name).
-m Retain previous file modification time. This option is ineffective on directories that are being copied.
-v Verbose.Print a list of file names.

EXAMPLE:


  1. find . -print | cpio -ocv > /dev/fd0

    Find list of files and directories and then copy those to floppy drive.
  2. find . -print | cpio -dumpv /home/nirmala

    Find list of files and directories and then copy or backup those to user.
  3. cpio -icuvd < /dev/fd0

    Restore the files back from the floppy.

Ask Questions

Ask Question