Web Hosting Talk







View Full Version : Using the Tar command


HostDogs
07-25-2002, 08:13 PM
Is it possible to tar up the public_html directory using ssh?

Also what would the command line be?

I figured then I could just point my browser to the tar file and download the file. Also by doing this would the site not be viewable?

Sorry these are such dumb questions

Lats
07-25-2002, 08:26 PM
It would be something like this:

tar cvf filename.tar public_html

You can then download that file via ftp.


Lats...

dandanfirema
07-25-2002, 08:27 PM
Or if you want it compressed, you can use tar zcvf filename.tgz /home/username/public_html/*

HostDogs
07-25-2002, 08:31 PM
Thanks

But will it tar everthing up and make the site unviewable? Or does it make a copy of everything?

Thanks again for your replies

chuckt101
07-25-2002, 08:34 PM
Host Dogs

It doesnt delete anything. Just make sure you have the hd space allocation available and use the previously mentioned commands.

dandanfirema
07-25-2002, 08:34 PM
It just creates a copy

HostDogs
07-25-2002, 08:40 PM
Thank you

HostDogs
07-25-2002, 08:42 PM
I would guess to untar it would be

untar zcfv filename.tgz public_html

Or is it a different command all together?

Thanks again

dandanfirema
07-25-2002, 08:43 PM
replace the c with an x

tar zxvf filename

Lats
07-25-2002, 08:44 PM
Something like:

tar xvf filename.tar

that will extract your files, depending on where you are at the time within your site.


Lats...

HostDogs
07-25-2002, 08:46 PM
thanks again

Tee
07-25-2002, 09:03 PM
tar gz it its better for zipping dir's

Mar-y-Sol
07-25-2002, 09:40 PM
For what is that command
May I ask?

driverdave
07-25-2002, 09:58 PM
Here's a really zany command

man tar

It actually tells you most of this thread. Crazy!!

fog
07-25-2002, 10:32 PM
Hang on... a VERY important note.

Make sure that the "tarball" (the file that tar outputs) is NOT in the directory/directories that you archive, otherwise you get into an infinite loop, and will fill up your disk pretty quickly.

Essentially, if you're backing up public_html, make sure you're not in public_html, or a subdirectory of it. I strongly suggest including the "z" option in order to compress the files.