LinuxQuestions.org
Visit Jeremy's Blog.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Debian
User Name
Password
Debian This forum is for the discussion of Debian Linux.

Notices

Reply
 
Search this Thread
Old 06-15-2005, 12:11 PM   #1
linx win
Member
 
Registered: Jan 2004
Posts: 390

Rep: Reputation: 31
How to use cpio to extract a cpio archive?


I tried to use Ark to extract a cpio archive but it told me that cpio format is not supported. I trid also with mc with no luck. I got the latest of cpio installed but do not know how to use it. I tried with man pages but not clear. Can some one explain how to do it? or tell me if there is a gui for cpio?
 
Old 06-16-2005, 06:33 AM   #2
YetAnotherDave
Member
 
Registered: Feb 2005
Posts: 94

Rep: Reputation: 17
It's hard to say for sure what will work w/o knowing the parameters used when the archive was created but this is worth a try:

cpio -id < archiveName

The -i says to extract and the -d says to create directories ahead of time if necessary. You might also want to try "-m" to preserve modification times on the restored files.

- Dave
 
Old 06-17-2005, 01:35 AM   #3
linx win
Member
 
Registered: Jan 2004
Posts: 390

Original Poster
Rep: Reputation: 31
Thanks dave. I am trying to edit a file called message that a distro uses to display its menu during bootup. I am able to open the file with:
cpio -im < message
I made the changes I need ant tried:
cpio -o > message2
but did work so I did:
cpio -o > message2
and got:
knoppix@box:~/work$ cpio -o > message
bash: message: Permission denied
knoppix@box:~/work$ su
Password:
root@box:/home/knoppix/work# cpio -o > message

It just stops for ages and do nothing.

Any idea?
 
Old 06-17-2005, 09:26 AM   #4
YetAnotherDave
Member
 
Registered: Feb 2005
Posts: 94

Rep: Reputation: 17
"cpio -o" takes a list of file names from standard input and archives those files to standard output.

In your case, you should do something like:

echo nameOfEditedFile | cpio -o > message2


If more than one file came from the original archive then you probably should list all of them:

echo nameOfEditedFile1 nameOfFile2 nameOfFile3 | cpio -o > message2

I'm a little surprised to see cpio used in this way. My typical use has been to combine cpio with find to archive all files in a directory or to copy files from one directory to another:

find . -depth -print | cpio -o > archive

or

find . -depth -print | cpio -pd /mnt/destination


Good Luck

- Dave
 
Old 06-17-2005, 01:53 PM   #5
linx win
Member
 
Registered: Jan 2004
Posts: 390

Original Poster
Rep: Reputation: 31
Thanks alot. It did work as you explained. I used:

find . -depth -print | cpio -o > message

as you suggested. I appreciate your help and very clear answers.

Last edited by linx win; 06-17-2005 at 03:55 PM.
 
  


Reply

Tags
cpio


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
CPIO extract error ramnath Linux - Software 2 06-02-2011 10:22 AM
rpm install proble--cpio: Archive file not in header mlgill Linux - Newbie 0 07-24-2004 11:53 AM
CPIO will not extract File stress Linux - Software 2 07-22-2004 01:04 AM
Using cpio on a 26GB archive produces "File too large" mfairclough Linux - Newbie 2 06-28-2004 05:55 PM
unpacking of archive failed: cpio: read failed-input/output error rafc Linux - Newbie 0 04-21-2004 09:03 AM


All times are GMT -5. The time now is 12:36 AM.

Main Menu
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration