Operating System - HP-UX
1826429 Members
4194 Online
109692 Solutions
New Discussion

Re: Exracting file from tar format

 
Ravikanth_2
Advisor

Exracting file from tar format

Dear All,

I have one y2k.tar file,which i restored from tape on my local server,ie HP-UX 10.20 plat form.Now how to un-tar this tar format file.so that i can exract files.

Please advice me on this.

Thanks
System Administrator
19 REPLIES 19
Hemanth Gurunath Basrur
Honored Contributor

Re: Exracting file from tar format

Hello Ravikanth,

Use the following command to untar the y2k.tar file.

tar -xvf y2k.tar

Hope this helps.

Regards,
Hemanth
Ravikanth_2
Advisor

Re: Exracting file from tar format

Nope ! its not working.Its not giving any o/p.simply its coming back to command prompt.
System Administrator
Zigor Buruaga
Esteemed Contributor

Re: Exracting file from tar format

Hi,

With the command suggested by Hemanth, you should have your extracted files into the same directory where "y2k.tar" file resides.
The command extracts the files and returns the prompt, no options.
Please, don't forget to assing points to Hemanth.

Kind regards,
Zigor
Ravikanth_2
Advisor

Re: Exracting file from tar format

Dear Zigor,

as per Hemanth advice i tryed the same but no files are exracted in same directory.i found only y2k.tar file.
System Administrator
Zigor Buruaga
Esteemed Contributor

Re: Exracting file from tar format

Hi again,

OK, try this:

- Create a new directory called "y2k".
- Then copy the file "y2k.tar" to that new directory. Then "cd" to the new directory and finally extract the files/folders with the command "tar xvf y2k.tar".
You should see "new" files or folders.
Let me know.

Kind regards,
Zigor
I.Delic
Super Advisor

Re: Exracting file from tar format

Hi,

Try this one:

tar -xvf /tmp/yourfile.tar

If you see some output on your monitor is good.

Your files must me in the /tmp directory

Good luck

Idriz
Keith Bevan_1
Trusted Contributor

Re: Exracting file from tar format

Ravikanth,

Are you sure its a tar format file ?

Try :-

file y2k.tar

If the response is tar file then you should follow Hermanth's original suggestion and as pointed out by Zigor the files will reside in the directory where you ran the tar command (probably where the y2k.tar file is located).

I would also like to echo Zigor's remarks regarding point assignments.
Its not compulsory but a good way of rewarding forum members who take their time to offer their expertise and knowledge to other forum members and colleagues.

I notice you have assigned 0 points to you 18 questions so far !

Keith
You are either part of the solution or part of the problem
Zigor Buruaga
Esteemed Contributor

Re: Exracting file from tar format

Opss, sorry I mean "tar -xvf y2k.tar" and NOT "tar xvf y2k.tar" ( I forgot the minus ).
Sorry.
Ravikanth_2
Advisor

Re: Exracting file from tar format

Dear Zigor,

I did the same as you adviced.But still no files are exracting from tar file.

Thanks and Regards
System Administrator
I.Delic
Super Advisor

Re: Exracting file from tar format

Hi,

it is simple :

tar -cvf /tmp/filename.tar to make one tar file
You can check your file with
file filename.tar
You should get answer it is an tar file

Then you typ:
tar -xvf /tmp/filename.tar to extract your tar file

try with an onther file

succes

Idriz
I.Delic
Super Advisor

Re: Exracting file from tar format

sorry

to make one tar file do:

tar -cvf /tmp/filename.tar *

Success
Zigor Buruaga
Esteemed Contributor

Re: Exracting file from tar format

Hi again,
I would recommend to follow the instructions given by the others, check with "file y2k.tar" if this is a tar file. Besides, be sure that you have restored the file from tape correctly ( same file size ).

Please post the output of "file y2k.tar" and "ll -a /your_dir".

Kind regards,
Zigor
Hemanth Gurunath Basrur
Honored Contributor

Re: Exracting file from tar format

Hello Ravikanth,

After going through the replies from Zigor, Delic and other peers, I would recommend that you do the following as suggested by them as well:

file y2k.tar

Check if it is a tar file or if it is a compressed file.

If it is a compressed file, use the foll. steps:

mv y2k.tar y2k.tar.Z
uncompress y2k.tar.Z
tar -xvf y2k.tar

Hope this helps.

For more info, refer to tar manpage.

Regards,
Hemanth
I.Delic
Super Advisor

Re: Exracting file from tar format

hi,

maybe you don't have permission to use tar command of you are in the directory where you can not extract your file's.

Can you check it ?

Idriz
Patrick Wallek
Honored Contributor

Re: Exracting file from tar format

What happens if you do:

# tar -tvf y2k.tar

That should show you a listing of files contained in y2k.tar file.

The location the files will be extracted to depends ENTIRELY on how the tar file was created. If the files were archived with explicit path names (like /y2k/file/whatever) then they will be restored to the same directory they came from. If they were archived with relative path names (like ./y2k/file or y2k/file) then they will be restored into the directory you are currently in.

The first think you need to check though, is whether or not this is a valid tar file.
Caesar_3
Esteemed Contributor

Re: Exracting file from tar format

Hello!

Check the type of file with:
file y2k.tar
You will see what type the file is,
tar or not.

Could be that the file also compressed
with gzip.

Caesar
Ravikanth_2
Advisor

Re: Exracting file from tar format

Dear All,

First of all i Apologies to everybody,if i hurt you all.

Finally i could able to sucessfully extract tar file.First i restored the tar file in / directory and i Used tar -xvf y2k.tar command.With this i got the o/p.

Once again i am very much thankfull to you for giving me your valuble suggestions and sparing your time.

Thanks and regards
System Administrator
I.Delic
Super Advisor

Re: Exracting file from tar format

hi,
I'm glad you dit it but some points is ok too.


succes

Idriz
Bruno Ganino
Honored Contributor

Re: Exracting file from tar format

THE RIGHT COMMAND IS
tar -xvf /device(OR PATH) filename
but tar command is very useful also for others uses.
See attachment.
HTH
Bruno
Torino (Turin) +2H