How to Zip or Unzip Files and Folders Using Command Line on Ubuntu Server?

How to unzip a zip file in Linux command line

Feeling confused about How to Unzip files and folders using an Ubuntu server? Sometimes you might need to upload or download a folder or file to/from your server and the folder/file can be of any size. It can take a lot of time to upload a folder or file to the server.



Also, it is a lot faster to move one large compressed file rather than multiple numbers of small files. Also, the FTP clients like FileZilla do not allow unzipping or zipping of files, but you can still do it via ssh(secure shell).


How to zip and unzip the files via Command line?

Follow these easy steps to zip the file or folder

Step 1: Login to the server :

ssh username@ your_server_ip
Example : ssh [email protected]

Step 2: Install zip (in case you do not have). To install the zip, type the following command

apt-get install zip

How to zip or unzip files and folders using command line on Ubuntu server

Step 3: Now to zip the folder or file enter the following command

zip -r original_folder

Here will be the zipped file while “original_folder” is the folder which you want to zip

This command will make the .zip file in the same folder where “original_folder” is present. But you can
change the destination of the target folder where zip file will be created. To change the destination folder
of .zip file while creating it just prepend the address where you want to create the .zip file

Note: Use -r in the command for the folder having more than one file or folder and do not use -r for
single file. Use the following command for a single file

zip original_file

Steps to unzip the .zip file

Step 1 : Login to the server via terminal

Step 2 : Install unzip (in case you do not have). To Install the unzip, type the following command

sudo apt-get install unzip

Step 3 : Navigate to the directory where .zip file, which you want to unzip, is presentHow to zip or unzip files and folders using command line on Ubuntu server

Step 4 : Now type the following command to unzip the file


where default is the filename which you wish to unzip


If you like our content we are sure you will love our Plans & Features Host Unlimited Websites. We offer -

    • FREE SSD storage
    • FREE SSL Certificate
    • FREE Offsite Backups
    • FREE Business Emails
    • FREE Daily Malware Scanning
    • FREE Premium Themes & Plugins
    • FREE WordPress Dev & Server Support

With every plan Starting just $16.61

How to zip or unzip files and folders using command line on Ubuntu server

© 2024 WPOven Inc. All rights reserved. WPOven® and WordPress® are registered trademarks.
WPOven is the best Managed WordPress hosting for agencies and businesses that want to succeed. With Unlimited sites hosting option, its easy to use and manage, so you can focus on growing your business. 
linkedin facebook pinterest youtube rss twitter instagram facebook-blank rss-blank linkedin-blank pinterest youtube twitter instagram