.\" The FSF version of cpio; manpage redone from tmac(?) to mdoc .\" by David Parsons .\" .Dd September 19, 2007 .Os Linux .Dt CPIO 1L URM .Sh NAME .Nm cpio .Nd copy files to and from archives .Sh SYNOPSIS .Nm .Bro Fl o Li | Fl -create Brc .Op Fl 0acvABLV .Op Fl C Ar bytes .Op Fl H Ar format .Op Fl M Ar message .Sm off .Op Fl O Li \0 Oo Oo Ar user Li @ Oc Ar host Li : Oc Ar archive .Sm on .Sm off .Op Fl F Li \0 Oo Oo Ar user Li @ Oc Ar host Li : Oc Ar archive .Sm on .Sm off .Op Fl -file Ns = Oo Oo Ar user Li @ Oc Ar host Li : Oc Ar archive .Sm on .Sm off .Op Fl -format Ns = Ar format .Sm on .Sm off .Op Fl -message Ns = Ar message .Sm on .Op Fl -null .Op Fl -reset-access-time .Op Fl -verbose .Op Fl -dot .Op Fl -append .Sm off .Op Fl -block-size Ns = Ar blocks .Sm on .Op Fl -dereference .Sm off .Op Fl -io-size Ns = Ar bytes .Sm on .Op Fl -quiet .Op Fl -force-local .Sm off .Op Fl -rsh-command Ns = Ar command .Sm on .Op Fl -help .Op Fl -version .Ar archive .Pp .Nm .Bro Fl -i Li | Fl -extract Brc .Op Fl bcdfmnrtsuvBSV .Op Fl C Ar bytes .Op Fl E Ar file .Op Fl H Ar format .Op Fl M Ar message .Sm off .Op Fl R Li \0 Ar user Oo Bro Sy : Li | Sy . Brc Ar group Oc .Sm on .Sm off .Op Fl I Li \0 Oo Oo Ar user Li @ Oc Ar host Li : Oc Ar archive Li .Sm on .Sm off .Op Fl F Li \0 Oo Oo Ar user Li @ Oc Ar host Li : Oc Ar archive Li .Sm on .Sm off .Op Fl -file Ns = Oo Oo Ar user Li @ Oc Ar host Li : Oc Ar archive .Sm on .Op Fl -make-directories .Op Fl -nonmatching .Op Fl -preserve-modification-time .Op Fl -numeric-uid-gid .Op Fl -rename .Op Fl t Li | Fl -list .Op Fl -swap-bytes .Op Fl -swap .Op Fl -dot .Op Fl -unconditional .Op Fl -verbose .Sm off .Op Fl -block-size Ns = Ar blocks .Sm on .Sm on .Op Fl -swap-halfwords .Sm on .Sm off .Op Fl -io-size Ns = Ar bytes .Sm on .Sm off .Op Fl -pattern-file Ns = Ar file .Sm on .Sm off .Op Fl -format Ns = Ar format .Sm on .Sm off .Op Fl -owner Ns = Ar user Oo Bro Sy : Li | Sy . Brc Ar group Oc .Sm on .Op Fl -no-preserve-owner .Sm off .Op Fl -message Ns = Ar message .Sm on .Op Fl -force-local .Op Fl -no-absolute-filenames .Op Fl -sparse .Op Fl -only-verify-crc .Op Fl -quiet .Sm off .Op Fl -rsh-command Ns = Ar command .Sm on .Op Fl -help .Op Fl -version .Sm on .Op Ar pattern... .Op Ar ../newfile .Pp When standard input is directed through a pipe to .Nm , as in the example above, it groups the files so they can be directed .Pq > to a single file .Pq Pa ../newfile . The .Fl c option insures that the file will be portable to other machines (as would the .Fl H option). Instead of .Xr ls 1 , you could use .Xr find 1 , .Xr echo 1 , .Xr cat 1 , and so on, to pipe a list of names to cpio . You could direct the output to a device instead of a file. .Ss Extracting files into directories .D1 example% cat newfile \&| cpio -icd "memo/a1" "memo/b*" .Pp In this example, .Nm .Fl i uses the output file of .Nm .Fl o .Pq (directed through a pipe with Xr cat 1 , extracts those files that match the patterns .Pq Pa memo/a1 , memo/b* , creates directories below the current directory as needed .Pq Fl d option , and places the files in the appropriate directories. The .Fl c option is used if the input file was created with a portable header. If no patterns were given, all files from .Pa newfile would be placed in the directory. .Ss Copying or linking files to another directory .D1 example% find \&. -depth -print \&| cpio -pdlmv newdir .Pp In this example, .Nm .Fl p takes the file names piped to it and copies or links .Pq Fl l option those files to another directory, .Pa newdir . The .Fl d option says to create directories as needed. The .Fl m option says to retain the modification time. (It is important to use the .Fl depth option of .Xr find 1 to generate path names for .Nm . This eliminates problems that cpio could have trying to create files under read-only directories.) The destination directory, .Pa newdir , must exist. .Pp Notice that when you use .Nm in conjunction with .Xr find 1 , if you use the .Fl L option with .Nm , you must use the .Fl follow option with .Xr find 1 and vice versa. Otherwise, there will be undesirable results. .Pp For multi-reel archives, dismount the old volume, mount the new one, and continue to the next tape by typing the name of the next device (probably the same as the first reel). To stop, type a .Sy RETURN and .Nm will end. .Sh DIAGNOSTICS .Ex -std .Sh BUGS This is the GNU implementation of cpio.