Tek Eye Logo

Tek Eye

Unzip File on VPS? How to Extract a Zip File on a Linux VPS

On Linux systems files are normally compressed individually to create a .gzip version using the gzip utility. Or several files are collected into a Tape Archive, .tar, which is an uncompressed collection of files created using the tar utility. A .tar is then compressed to a .gzip to create a .tar.gz. In Windows files are normally zipped, which is a format that collects and compresses several files into a single .zip file in a single operation.

Zip Icon

Tutorial to Upload and Extract a Zip File from Windows to a CentOS VPS

When managing a Linux based Virtual Private Server (VPS) or other remote Linux machine, such as a web server, there can be occasions when a zip file created on Windows needs to be extracted and managed on the remote Linux machine. This can be done with the Linux zip (to compress) and unzip (to extract) utilities. This tutorial shows how to use zip and unzip on a CentOS Linux install, the commands apply to other versions of Linux.

CentOS Logo

Install Zip and Unzip onto CentOS

A VPS may not run a full blown Linux, for example a CentOS VPS may run the minimal CentOS installation for efficiency. In which case the zip and unzip utilities may not be installed. These utilities can be installed on CentOS using yum:

# yum install zip unzip

Or for sudo users:

$ sudo yum install zip unzip

To check if zip or unzip is installed the commands yum info zip unzip or yum list installed | grep zip are sometimes suggested. A more concise command is simply rpm -q unzip zip:

# rpm -q unzip zip
package zip is not installed

The result above showing that unzip is installed but not zip.

Upload a Zip File to a Linux VPS from Windows

There are several options available to upload a zip file from a Windows machine to a VPS or remote Linux machine:

  1. Use a hosting providers control panel.
  2. Use secure copy (SCP) with WinSCP (or PuTTY).
  3. Install a control panel such as Webmin.
  4. Use a machine to machine transfer with wget.

Upload with the Hosting Providers Control Panel

The most common way to upload a zip file to a Linux server or VPS is to use the hosting provider's control panel. For a VPS, website hosting service, or other remote machine the service provider usually provides software to allow for files to be uploaded. The upload functionality is normally part of a file manager utility, provided as part of a control panel package, such as the popular cPanel.

cPanel has a File Manager

Upload with Secure Copy using WinSCP

If a file manager is not available then the upload can be done via secure copy, scp, based on the secure shell (ssh) protocol.

The well established PuTTY program is used as a secure shell for Windows computers (see SSH into VPS Virtual Machine on Windows Using PuTTY), it supports secure copy with the pscp utility. This can be used to copy a zip from Windows to a remote Linux VPS. However, it is run from a command (DOS) prompt and it can be difficult getting the correct command line arguments. An easier to use alternative is WinSCP. The WinSCP program provides a GUI interface and supports drag and drop transfers between a Windows machine and Linux box. Login is the same as PuTTY, providing a server name or IP address, username and password. (Accept the WinSCP secuity message when logging in for the first time.)

WinSCP Login for Windows to Linux file transfers

WinSCP shows an interface with both the local and remote computer directories. Find the zip file on the local machine and drag and drop it to the required directory on the remote Linux machine.


Upload a Zip with Webmin

If the VPS or remote Linux machine does not come with a control panel it is possible to use one of several freely available, for example Webmin. See Webmin CentOS Install for Easier VPS Management. The free Webmin control panel has a File Manager that can be used for uploading. Use the File option and then select Upload to current directory.

Upload Zip with Webmin

Use wget to Transfer Zip Files Between Remote Servers

To transfer a zip file between remote servers it isn't necessary to do a download to a local machine first. If the zip file is on a public web location then use the wget utility in the secure shell to copy it to the other remote machine directly. Again for minimal Linux systems wget may require installation. On minimal CentOS use yum to install wget:

# yum install wget

To grab the remote zip file just pass the HTTP address to wget (change directory to the location you want to store the zip file first).

# wget http://www.example.com/zipped_files.zip

Unzip File using Unzip

Note: Unzipping files can be a dangerous operation, overwriting existing files. Always take regular backups of work before performing operations that can potential overwrite data. Check that the unzip operation is not going to cause any issues. If in doubt practice on a test machine first.

To extract the files use the unzip command:

# unzip zipped_files.zip

There are lots of optional commands for the unzip, and zip, utilities. For example extracting to a specific location using -d. To see a list of supported commands use the help option:

# unzip --help

Unzip a File using Control Panel

Some hosting control panels have an unzip button or option in the file manager. If available use it to extract the files in the zip. The unzip option may extract to the same location as the zip file, or may show a dialogue to enter a destination folder. Check hosting provider's documentation for more information.

Unzip File on VPS From Windows Summary Options

  • Install zip and unzip using yum on CentOS (yum install zip unzip).
  • If supported use the control panel file manager to upload (Webmin is a free control panel) and optionally unzip.
  • Or use secure copy with WinSCP or the PuTTY program pscp to send the file to the remote VPS.
  • Use the unzip utility in the terminal (unzip filename.zip), some control panels support unzipping files.
  • Use --help option for additional zip and unzip commands, e.g. extract to a specific directory.

See Also

Author:  Published:  Updated:  

ShareSubmit to TwitterSubmit to FacebookSubmit to LinkedInSubmit to redditPrint Page

Do you have a question or comment about this article?

(Alternatively, use the email address at the bottom of the web page.)

 This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

markdown CMS Small Logo Icon ↓markdown↓ CMS is fast and simple. Build websites quickly and publish easily. For beginner to expert.

Articles on:

Android Programming and Android Practice Projects, HTML, VPS, Computing, IT, Computer History, ↓markdown↓ CMS, C# Programming, Using Windows for Programming

Free Android Projects and Samples:

Android Examples, Android List Examples, Android UI Examples

Tek Eye Published Projects