advantages of cpio command?


 
Thread Tools Search this Thread
Top Forums UNIX for Dummies Questions & Answers advantages of cpio command?
# 8  
Old 08-18-2008
As era correctly assumed, tar was initially a tool for creating and extracting tape archives, hence its name.
For instance the manpage for tar on HP-UX still mentions this
Quote:
tar(1) tar(1)

NAME
tar - tape file archiver
And for those historic kind of uses it goes on, informing that indeed the -f option can be omitted,
where it defaults to the first non-rewinding tape device special file
Quote:
DESCRIPTION
The tar command saves and restores archives of files on a magnetic
tape, a flexible disk, or a regular file. The default archive file is
/dev/rmt/0m. See the -f option below. Its actions are controlled by
the key argument.
Of course, on Linux distros bundled with the GNU tar this does not apply
because I think that Linux wasn't targeted in the first place at users who can afford
expensive tape drives and media.

Both tools have their pros and cons.
Of course, we must not confuse the myriad of features the GNU tar offers nowadays
with those spartan tar implementations that you would find on most commercial Unices.

Historically, tar didn't back up special files.
Also you couldn't easily exclude files from being captured in the archive
as well as not restrict the recursion to filesystem boundaries.
(GNU tar today has all sorts of options that let you do this)
On the other hand it is easy to append files to existing tar archives which you can't with cpio.
Another drawback of cpio is that it usually only is useful in combination with find,
which makes two stat() syscalls for each file (albeit the second is read from the buffer cache).
One big strength of cpio draws from the abundance of filter criteria,
which on the other hand can become quite daunting to the average user.
Think of the arcane -prune logic with lots of quoting noise for parens if you want to exclude certain dirs.

But to the remedy came a tool which sadly his often hardly known.
It kind of took its name from the former rivalry of the two, tar vs. cpio.
As pax is the Latin word for peace, so it is aptly named.
pax lets you do much more than a mere tar (e.g. in situ renaming of target paths or stripping) while it maintains tar's ease of use.
pax should really be given more attention.
 
Login or Register to Ask a Question

Previous Thread | Next Thread

9 More Discussions You Might Find Interesting

1. UNIX for Advanced & Expert Users

Cpio - input files (from list) are stored in different order inside cpio archive - why?

Due to budget constraints I have to reinvent an Enterprise backup system in a SPARC (sun4v) Solaris estate (10 & 11). (yep - reinvent wheel, fun but time consuming. Is this wise?! :confused: ) For each filesystem of interest, to try to capture a 'catalog' at the front of each cpio archive (for... (1 Reply)
Discussion started by: am115998
1 Replies

2. Solaris

About cpio command

i need to extract cpio file archived full path to /restore/ (not full path or fullpath under this directory ) i can't find option for cpio please help me example. i have cpio file archive /etc/* and i need to extract file to /restore #cpio -ivBcdmu < xx.cpio but data from cpio not... (3 Replies)
Discussion started by: infjustice
3 Replies

3. UNIX for Dummies Questions & Answers

What are some advantages of Unix?

What are some advantage's of Unix (3 Replies)
Discussion started by: alvin2132
3 Replies

4. UNIX for Dummies Questions & Answers

Using cpio with the find command

Hey everyone, I’ am a newbie to Unix. Learning some of the basic commands. I did some piping before like who | wc I wanted to practice some backup features in Unix. I’ am practicing using cpio and place it into a file named backup. I’m not quite sure where I’ am going wrong? ... (1 Reply)
Discussion started by: fox987
1 Replies

5. Shell Programming and Scripting

advantages of Perl ?

What is the advantages of Perl in Unix environnement. Is it for scripts ? Text manipulation ? Have you a Concrete exemple of perl utilisation. Thanks you (3 Replies)
Discussion started by: simquest
3 Replies

6. UNIX for Dummies Questions & Answers

Restoring a directory using cpio command?

I am confused with how to restore archives. I just figured out the use of tar, but now after trying it with cpio, I'm unsure of some things. Firstly, is it necessary to cd to the directory you will be restoring to in order to run this command? Secondly, what is it I'm doing wrong when trying to... (2 Replies)
Discussion started by: Relykk
2 Replies

7. UNIX for Dummies Questions & Answers

Advantages of Groups

What are the advantages of putting users into groups? I understand that in a corporate environment, you should create a group for each department. ie: putting finance employees into a finance group. But are there any system advantages for doing that? How would it make it easier on the system... (3 Replies)
Discussion started by: kurtmc
3 Replies

8. UNIX for Dummies Questions & Answers

Linux advantages?

Hello to help me with my studying of unix/linux outside of work I was thinking of installing Linux at home aswell as using Windows XP. Im pretty new to Linux and Unix, could someone tell me the possible benifits or even negatives of running Linux at home as an opperating system as opposed to... (2 Replies)
Discussion started by: Loaded Gun
2 Replies

9. UNIX for Dummies Questions & Answers

cpio command with compress

Hi friends.. I want to be able to copy a file from one location to another (locally). The location the files are copied to should have compressed instances of the files they were copied from. copy from /home/user/test.file copy to /backup/user/test.file.Z I need to be able to do this... (1 Reply)
Discussion started by: sureshy
1 Replies
Login or Register to Ask a Question