Extract tar.gz on the FTP?



I’m tired of uploading tons of files, and was wondering if it’s possible to upload a tar.gz file and just extract it on the server? It would save me a lot of time.


Yes, but not through FTP. You’ll need to use FTP to upload the file and then use SSH to gain command line access where then you can extract the file.

The command to extract a file is: tar zxf file.tar.gz

x - extract
z - it’s gzipped
f - supplying filename on command line.

If the file is on a remote server (and you’re just using your desktop as a “proxy” to xfer files) you can get even fancier and use wget to download the directly on your site. Again, through SSH command is: wget http://domain.com/url/to/file.tar.gz

Then use the above tar command to extract it.

yerba# rm -rf /etc


Ok. That’s what I was hoping for :slight_smile: Thanks a lot, this will help me save time so I don’t have to upload a gazillion small files :slight_smile: I’m testing CMS’s, so it’s a drag everytime I wanna test a new one =)


You could also save time by downloading straight to the server in shell using

wget http://example.com/file.tar.gz
wget ftp://ftp.example.com/file.tar.gz


I’ll check that out when I can. Most of what I’ve downloaded now is from SourceForge sites, so can’t really do that there I think :slight_smile:


Hm. What info do I need to connect via SSH? I used my domain name, and then I got queried for username and password, so I tested what I use to log in @ dreamhost.com control panel, but that didn’t do the trick :confused:


You have to log in with the user associated with the domain you want to access. That user also has to have been granted shell access from the panel. See the wiki article ‘ssh’ for more help.

You can downalod directly to the server from sourceforge. in your browser, find the file you want, selecte the mirror, then when the save as box pops up on your screen just click cancel and copy the url at the top of the page. it says, if your download doesn’t start automatically try this link: http://… just plug that into wget. I normally take a mirror in Arizona as that seems to be the closest one.

art.googlies.net - personal website


Ok, I’ll see what I can find out, and I’ll check teh wget thing also :slight_smile:

Thansk for being patient!


It all worked, both wget and the extracting thing. Had to enable SSH for my user.

This is very nice :smiley: thanks a lot people! This will make things so much easier =)

Btw, I’m in Sweden (I’m Norwegian though), used wget and a mirror from Dublin, worked like a charm.


To save on unnecessary bandwidth, you should select a mirror close to the server, which is located in US, California, L.A… Rather than making it download the same file across the ocean, let it download the file from only a few hundred miles.

Glad to hear you got things working thoough.

art.googlies.net - personal website


Ah, of course, I forgot the server is in the states :wink: yeah, I’ll do that next time, thx :slight_smile:

Yeah, it all good now, nice to finally know this, have wondered about these things for a long while now, just never gotten around to try and figure it out.