Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

My sysadmin is unreachable right now, and I have a zipped file on the server that I would like to unzip...however, we don't currently have zip and unzip installed, and I don't have root access to install them...

Am I out of options entirely? Are there other things that can unzip this file?

share|improve this question

closed as off-topic by Dennis Kaarsemaker, Iain, Tim Brigham, mdpc, Ward Aug 11 '13 at 2:07

This question appears to be off-topic. The users who voted to close gave this specific reason:

  • "Questions must be relevant to professional system administration. Server Fault is a site dedicated to professionals; novice questions are off-topic. Please see the Help Center for more information on topicality. The best advice we can give you is to hire a professional to help you out." – Dennis Kaarsemaker, Iain, Tim Brigham, mdpc, Ward
If this question can be reworded to fit the rules in the help center, please edit the question.

    
Is tar not installed? tar -x –  spuder Aug 10 '13 at 20:20
    
just tried tar -x file.zip and it seems to be doing something... –  johnnietheblack Aug 10 '13 at 20:21
    
@spuder you should leave an answer in case this works, and i'll upvote ya –  johnnietheblack Aug 10 '13 at 20:22

6 Answers 6

up vote 3 down vote accepted

I haven't tried this, but, there's a zipfile module in Python's standard library since version 1.6, and since version 2.6 has had an extractall method

You should be able to do something like:

  1. Create a file with the following contents (editing it to fit your use case).
  2. Save the file as "unzipfile.py"
  3. Run with python unzipfile.py

And it'll extract test.zip to /home/user/directory.

import zipfile

with zipfile.ZipFile('test.zip', "r") as z:
  z.extractall("/home/user/directory")

Source: http://stackoverflow.com/a/9432315/167299

Alternatively, BusyBox contains an unzip "module", and if you could download and run the statically-linked BusyBox, then you could use that to unzip things.

share|improve this answer
    
i tried the first part of this and got: The program 'import' can be found in the following packages: * imagemagick * graphicsmagick-imagemagick-compat - btw...i didn't downvote you –  johnnietheblack Aug 10 '13 at 20:19
    
Oh. You know you need to run it through Python? –  Tom O'Connor Aug 10 '13 at 20:27
    
Like, Type python, then run python, and type that into the interpreter. –  Tom O'Connor Aug 10 '13 at 20:27
1  
WOW. looks like it worked....I stumbled thru successfully in interactive mode! –  johnnietheblack Aug 10 '13 at 21:07
2  
Welcome to Python. It's awesome. –  Tom O'Connor Aug 10 '13 at 21:14

If you have java installed, the jar command can unzip a zipped file:

jar xvf file.zip 

Note that you can install java without root access: http://docs.oracle.com/javase/7/docs/webnotes/install/linux/linux-jdk.html

share|improve this answer
    
Today I Learned. –  Tom O'Connor Aug 10 '13 at 20:08
    
The program 'jar' can be found in the following packages: * default-jdk * fastjar * gcj-4.6-jdk * openjdk-6-jdk * gcj-4.5-jdk * openjdk-7-jdk Ask your administrator to install one of them :( –  johnnietheblack Aug 10 '13 at 20:20
1  
See my answer update. –  jlliagre Aug 10 '13 at 20:24
    
I am a little scerred to install anything on the server, for fear of the wrath of my sysadmin, but i will definitely try this if need be. –  johnnietheblack Aug 10 '13 at 20:38

I don't believe there are other ways of unzipping the file on a system without unzip, but you could send the file to another linux system (with unzip installed or root access available), unzip the file there and - if necessary - send the unzipped file back to the original server.

The command to send a file from one server to another is scp. The syntax to send the file is:

scp <filename> <username>@<otherhostname>:<portnumber><fullpathtolocation>
e.g.: scp file.zip  user@server.example.com:2222/home/user/ 

Hope this helps!

share|improve this answer

If the server has Gnome running, use the archive utility

enter image description here

http://www.wikihow.com/Unzip-Files-in-Linux

share|improve this answer

Copy the file to another machine, unzip, and copy back.

share|improve this answer

BSD / Mac OSX

The tar utility that ships with Mac and BSD derivatives, support extracting zip archives from the tar command

tar -xvf foo.zip

tar --version
bsdtar 2.8.3 - libarchive 2.8.3

Debian / RHEL

The tar archive that ships with Ubuntu and others does not support extracting zip files. The best option will be to scp the file to a machine with zip installed.

tar -xvf foo.zip
tar: This does not look like a tar archive
tar: Exiting with failure status due to previous errors

Smoke Test

echo "the quick brown fox jumped over the lazy dog" > bar.txt
zip -r bar.zip bar.txt
rm bar.txt
tar -xvf bar.txt
cat bar.txt
the quick brown fox jumped over the lazy dog

Update

Rewrote answer to clarify that tar -xvf only works on bsd OS's. While it is good information, It will not work in this scenario after all.

share|improve this answer
    
what does the -zxvf do? –  johnnietheblack Aug 10 '13 at 20:27
    
when i try that, i get tar: This does not look like a tar archive tar: Skipping to next header ... does that mean it failed, or still going? –  johnnietheblack Aug 10 '13 at 20:29
    
tar ability to process zip files would be an extension Ubuntu tar (i.e. GNU tar) doesn't seem to provide. -z is for gzipped files, not zipped ones (unless it is a very recent extension). –  jlliagre Aug 10 '13 at 20:29
    
does that mean if i upload a gzip it would work? –  johnnietheblack Aug 10 '13 at 20:30
    
It will, but that's not your question ;-) –  jlliagre Aug 10 '13 at 20:31

Not the answer you're looking for? Browse other questions tagged or ask your own question.