How to unzip a file on a server using SSH

It can save a lot of time to upload a single file to your web server then extract it, rather than extracting to your own computer and uploading the contents.

Assuming you’ve managed to upload the file to your server (e.g. using FTP), and connect via SSH to a unix server (PuTTY is a good client), follow these steps to extract it.

  1. Navigate to the directory containing your file. Use the command cd (change directory), for example: cd MyDirectory. You can use ls to view the files in each folder.
  2. Use the unzip command to extract: unzip MyZipFile.zip. Type unzip by itself to find out more about it, including various options for using it.
  3. If you want to move the files you’ve just extracted, you can use the mv command. If the files have been extracted to a subfolder and you want them out, try mv MyZipFile/* . (the dot indicates that you are moving them to the current folder).
  4. Finally, you can delete the zip file if you don’t need it anymore by rm MyZipFile.zip.

Comments