You are not logged in.

#1 2012-03-06 01:57:35

Odyssey
Member
Registered: 2007-02-11
Posts: 13

[SOLVED] How to create tarball in another directory

I want to zip my /home directory, but have the tarball file created outside of /home to avoid a "double compression" problem.

I have tried several variations of tar with various switches and destinations, but nothing wants to work. Have read the tar man pages and they are way too technical for me, and google is not being helpful. 

Could I trouble someone to please give me the line of code to collect everything in my current /home and zip it into one tarball,

and have the tarball show up in /opt (where there is space for it (or if /opt is not a good place to put it, your suggestion)?

Any explanation of what any recommended switches accomplish in simple English will be greatly appreciated.

I think the basic tarball creation should be the following, which please confirm, but how to get the tarball created in /opt directory?

tar -czvf currenthome.tar.gz /home

Many thanks

Last edited by Odyssey (2012-03-08 00:09:14)

Offline

#2 2012-03-06 02:14:43

Trilby
Inspector Parrot
Registered: 2011-11-29
Posts: 29,616
Website

Re: [SOLVED] How to create tarball in another directory

Er .... what's wrong with

# tar -czvf /opt/currenthome.tar.gz /home

I'm not particularly experienced with this - but I'd assume you've tried that and had some problem.


"UNIX is simple and coherent..." - Dennis Ritchie, "GNU's Not UNIX" -  Richard Stallman

Offline

#3 2012-03-06 02:15:51

/dev/zero
Member
From: Melbourne, Australia
Registered: 2011-10-20
Posts: 1,247

Re: [SOLVED] How to create tarball in another directory

Just give the resulting tar an absolute address.

tar cjvf /tmp/home.tar.bz2 /home

Offline

#4 2012-03-06 03:38:54

Odyssey
Member
Registered: 2007-02-11
Posts: 13

Re: [SOLVED] How to create tarball in another directory

That did it. Thanks to both.

Offline

#5 2012-03-06 03:39:53

/dev/zero
Member
From: Melbourne, Australia
Registered: 2011-10-20
Posts: 1,247

Re: [SOLVED] How to create tarball in another directory

Please remember to mark the thread solved, and in future try a little inventive experimentation before starting a new thread in the forum.

Offline

#6 2012-03-06 13:51:38

Odyssey
Member
Registered: 2007-02-11
Posts: 13

Re: [SOLVED] How to create tarball in another directory

Thank you for your constructive guidance. I did spend the better part of an hour trying to do it at the command line, reading the man pages, and googling before asking for help. In hindsight, the correct command seems blindingly obvious, but when you are blind it is hard to see. I am very much a noob, hence my posting in "Newbie Corner" but I am learning.

Last edited by Odyssey (2012-03-06 13:55:05)

Offline

#7 2012-03-06 14:29:23

karol
Archivist
Registered: 2009-05-06
Posts: 25,440

Re: [SOLVED] How to create tarball in another directory

You forgot to mark the thread as solved.
https://bbs.archlinux.org/viewtopic.php?id=130309

Offline

Board footer

Powered by FluxBB