scriptygoddess

11 May, 2003

Zipped Archives in Unix Shell

Posted by: Jennifer In: How to's

If you're working with scripts, the time will come when you need to work with a Unix archive. Generally, these are .tar files or .tar.gz (zipped). These .tar files are commonly called "tarballs". These are no different than any other archive/backup/zipped files, they just take a little getting used to.

How to decompress a .tar or .tar.gz archive in Windows:
Winzip is my windows-based zip file manager of choice. There are several versions available, included a free "evaluation" version. Winzip can decompress .tar and .tar.gz files locally to your hard drive. Make sure you use the wizard or select "Use Folder Names" from the Classic interface so the file structure will be maintained.

How to decompress a .tar or .tar.gz archive on your webserver:
You need shell access (telnet or ssh). If you don't have shell access, you'll just have to decompress the tarball local (see Windows directions above) and upload via ftp.

1) Assuming you have shell access, upload the tarball to your webserver in binary mode via ftp. (Note: Choose binary mode, not ascii or automatic detect – binary). Most of the time, you'll want to place the tarball one level above where you want the files installed, as the structure of most tarballs begins with a folder.

2) Once the tarball is on your server, log into your shell account (ask your host for directions).

3) Use the following commands to decompress:

.tar files: tar -xvfz filename.tar
.tar.gz files: tar -xvfz filename.tar.gz

4) The files will decompress into it's original uncompressed structure. You can browse the structure using your ftp program or other tools that are more familiar to you.

While we're at it, let's just round out this topic.

How to zip a folder in Unix:
To create an archive from the Unix shell (telnet/ssh), use the following command:

tar -cvzf filename.tar.gz folder-name

So, if I want to create a tarball to backup my "images" folder, I'd use the following command:

tar -cvzf images.tar.gz images

Note the space between the "z" and the name of the folder I am compressing. You can create archives of individual files as well, just replace the "folder-name" in the example with a file name (i.e. "image.jpg").

If you need a good telnet/ssh client for windows, I recommend Putty. For more information on unix shell commands, google "unix shell commands". There are 1,000s of good resources.

Guest authored by:
Kevin Donahue – blog.kevindonahue.com

2 Responses to "Zipped Archives in Unix Shell"

1 | haans

October 31st, 2003 at 1:15 pm

Avatar

Hey Jennifer,

I'd like to set one of these up on my server as soon as I have changed it over to PHP. Can you please email me so we can chat, when you have some time of course. Thank you.

peace,
and God Bless,

Haans :)

2 | Mark

May 5th, 2004 at 12:40 pm

Avatar

HI Goddess,

I'm trying to compile ircii4.4 on a MAC OSX2.2 and it is failing. I get the following:

setting up config.h…
calling configure…
loading cache ./config.cache
this is ircii version 4.4

checking for gcc… no
checking for cc… no
configure: error: no acceptable cc found in $PATH

Any help?

Thanks

Mark

Featured Sponsors

Genesis Framework for WordPress

Advertise Here


  • Scott: Just moved changed the site URL as WP's installed in a subfolder. Cookie clearance worked for me. Thanks!
  • Stephen Lareau: Hi great blog thanks. Just thought I would add that it helps to put target = like this:1-800-555-1212 and
  • Cord Blomquist: Jennifer, you may want to check out tp2wp.com, a new service my company just launched that converts TypePad and Movable Type export files into WordPre

About


Advertisements