Another command similar to
cpio. This program allows you to create archives from lists of filenames. Additionally, it is used to extract tar archives and copy files from a source to a device or file.
cpio command is especially useful since you don't need to create an intermediate file before moving it to another disk.
There are three modes that come with the
The copy-out mode, denoted with the
--create options, allow you to make an archive and copy files into it. Simply pass in a list of filenames (one per line) into the standard input.
An easily way to generate a list of filenames is with the
$ find ./sample ./sample ./sample/file1 ./sample/file2 ./sample/file2 $ find ./sample | cpio -o > /media/myusb/sample.cpio 1 block
This is great, but the file is uncompressed. To compress it, use
$ find ./sample | cpio -ov gzip > /media/myusb/sample.cpio.gz
Other options you may use include
-v for verbose and
-depth to specify folder depth.
Whereas copy-out mode creates an archive, we can use copy-in to extract the archive contents. Simply pass in the
--extract option, and pass in the archive through standard input.
$ cpio -i < /media/myusb/sample.cpio # If compressed: $ gunzip -c /media/myusb/sample.cpio.gz | cpio -i
-c option of
gunzipoutputs the contents to standard out.
The third mode is copy-pass, which is useful for moving files from one directory tree to another without creating an intermediate archive. This mode can be thought of as a combination of the two mentioned above. To activate copy-pass mode, use
-p or the
Here is a list of more options you can use with the
Relieve your stress, back, neck and sciatic pain through 1,782 acupuncture points for immediate neck pain relief. Made for lower, upper and mid chronic back pain treatment, and improves circulation, sleep, digestion and quality of life.$$ Check price
Linux for Beginners doesn't make any assumptions about your background or knowledge of Linux. You need no prior knowledge to benefit from this book. You will be guided step by step using a logical and systematic approach. As new concepts, commands, or jargon are encountered they are explained in plain language, making it easy for anyone to understand.$ Check price