Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

I have connected to my remote server via FTP and I got a directory listing. I have few zip files in the list.

Is it possible to unzip the file (Ex: test.zip)?. If yes, what is the command?

share|improve this question

migrated from stackoverflow.com Sep 26 '12 at 6:56

This question came from our site for professional and enthusiast programmers.

    
after unzip install, command is unzip test.zip –  vusan Sep 26 '12 at 6:45
    
...through ubuntu terminal... Just for the sake of it, that's not a connection option, that's an application. Did you connect via SSH, SFTP, FTP or some other means? –  Bobby Sep 26 '12 at 7:13
    
This is ftp connection –  Hearaman Sep 26 '12 at 7:31

7 Answers 7

up vote 6 down vote accepted

It is not possible to unzip files over an FTP connection. FTP stands for "File Transfer Protocol", which was only designed to transfer and partly manage files on the remote end, but not to execute commands. To unpack an archive you'd have to execute a program like tar, bzip2 or similar, but that's not possible via a FTP connection.

You need another session which allows you to execute commands, like SSH. Or you unpack the archive on your machine and transfer the contents via FTP, which will be considerable slower if you have a large number of small files because of the overhead of FTP.

share|improve this answer
    
are there any softwares(linux) to unzip my files. –  Hearaman Sep 26 '12 at 7:49
    
@Hearaman the command unzip. –  Kruug May 6 '13 at 17:55

http://linux.about.com/od/commands/a/blcmdl1_unzipx.htm

simple case - unzip test.zip

share|improve this answer
    
This was super easy. I uploaded the zip file via FTP and then used SSH to access the server where I ran the simple command unzip nameoffile. Thanks. –  fmz Jun 17 at 14:33

You can use unzip after running sudo apt-get install unzip.

share|improve this answer
    
i have installed the unzip package using sudo apt-get install unzip. But it is giving me invalid command –  Hearaman Sep 26 '12 at 6:48
    
You can use it like "unzip filename.zip -d /destination" –  fraabye Sep 26 '12 at 6:50

you can use tar command

tar -xfz test.zip
share|improve this answer
    
To remember the letters: eXtract Zee Files –  Canadian Luke Sep 26 '12 at 7:01
    
invalid command is coming in my console. –  Hearaman Sep 26 '12 at 7:04
    
with -xzf instead of -xfz? –  HaydnWVN Sep 26 '12 at 7:37
    
(Requires root permision)install tar by sudo apt-get install tar –  user1602914 Sep 26 '12 at 11:24
    
try to open the ftp link in Nautilus,right click on the zip file, and check whether there is "extract here" option. –  user1602914 Sep 26 '12 at 11:30

Is your goal to unzip it on the external server, or do you want to pull the archive contents to your own computer?

The first case is not solved by FTP, but by SSH or similar techniques as described in other answers.

If you just want to get the unzipped contents "directly" to your own computer without first explicitly transferring the files and then unzipping, you could e.g. mount the FTP site as a folder and unzip it as a normal zip file to a location on your local computer. This will in practice stream the file contents directly to the unzip program, so you technically do transfer the whole file, but only in its zipped state (presumably saving traffic) and the contents will appear directly on your local computer without the explicit intermediate step.

I don't know how the zip file format is specified concerning just unzipping a part of a zip file; if you need to transfer the whole file nevertheless or only the compressed part corresponding to that file. I don't see any real technical reasons as to why it wouldn't be possible to do this kind of selective transfer (the FTP protocol allows only transferring partial files to enable resuming).

share|improve this answer

You can do it if you mount ftp resource using curlftpfs:

curlftpfs ftp://ftp.server.org/ /path/to/mountpoint

then

unzip /path/to/mount/test.zip
share|improve this answer

As far as I know some FTP servers are set up to automatically unzip files on download. For example, the server lists a file named test.txt.gz, with your ftp client you can type get test.txt, the server then sends the file through unzip.

This is the answer that can be read right before download begins : 150 Opening ASCII mode data connection for /usr/bin/gzip.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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