1748058 Members
5700 Online
108758 Solutions
New Discussion юеВ

Tar

 
SOLVED
Go to solution
fizan
Super Advisor

Tar

Team,

tar -cvf /home/test.tar /home/sfdm*

done created a tar file inside home named as test.tar.

when i am tryting to untar it, it is untaring but go and resides on the original place as /home/sfdm.

I need to restore to diff location as /home/test1/ inside i need to restore it??

command plz?

Thanks
9 REPLIES 9
Larry Klasmier
Honored Contributor

Re: Tar

cd into /home/sfdm before you create the tarball.

then tar -cvf /home/test.tar *

fizan
Super Advisor

Re: Tar

Attempt to create archive of no files. Nothing dumped.
[as-tmp]/home/sfmdb
did but nothing get tared on that file 0KB
merieux
Frequent Advisor

Re: Tar

Hi ,

You have two way to tar something :

With the method that you have use : In this case tar and untar use abolute PATH because the tar file is made whit absolute PATH

With relative PATH : If you tar something by using relative PATH your resulting tar file will can be untar at anyway ext ( cd /home ; tar *sfdm* test.tar

Have a good day
fizan
Super Advisor

Re: Tar

tar *sfmdb* test1.tar
tar: s: unknown option
tar: usage tar [-]{txruc}[eONvVwAfblhm{op}][0-7[lmh]] [tapefile] [blocksize] [[-C directory] file] ...
vishnu.khandare
Respected Contributor

Re: Tar

Hi Fizan,

Hope u know the basics of Tar,
to untar use the below command,
tar -xvf filename.tar path where to extract

u can refer below link,
http://www.sikh-history.com/computers/unix/commands.html

Hope this solves ur issue
Please assign points

Regards
Vishnu Khandare
You should deserve before U desire!!!!
fizan
Super Advisor

Re: Tar

# tar -xvf home.tar /sap/t1
[rx26-207]/sap
# cd /sap/t1
[rx26-207]/sap/t1
# ll
total 0
[rx26-207]/sap/t1
#

no it dosent work out.
vishnu.khandare
Respected Contributor

Re: Tar

Do as follows

#cp home.tar /sap/t1
#cd /sap/t1
#tar -xvf home.tar .

It will definitely work if not check the tar file size.


Hope this solves ur issue

Regards
Vishnu Khandare
You should deserve before U desire!!!!
Dennis Handly
Acclaimed Contributor
Solution

Re: Tar

>I need to restore to diff location as /home/test1/ inside I need to restore it?

There are several ways to do this:
1) tar it off again, this time relative:
tar -cvf /home/test.tar -C /home sfdm # list each one under sfdm*
(Probably easier to go to /home and use wildcards.)

2) Give up on tar and use pax(1) -s:
pax -r -v -f /home/test.tar '-s:/home/::'

3) Give up on tar and use gnu tar.
Mike Miller_8
Regular Advisor

Re: Tar

cd /home
tar cvf test.tar sfdm*
cd /home/test1
tar xvf /home/test.tar

This will create a relative tar file called test.tar in the /home directory and then extract that information to the /home/test1 directory.