Skip to content
Hosting Manual
  • Hosting Reviews
    • Bluehost Review
    • GreenGeeks Review
    • Inmotion Hosting Review
    • iPage Review
  • SLA & Uptime Calculator
  • Services
    • WordPress Migration Service
    • WordPress SEO Optimization
    • WordPress Speed Optimization
  • Domain Search

Zipping and Unzipping Files in Linux

There are several methods of archiving files and retrieving archives in Unix-like systems like Linux. I personally use Ubuntu but you can apply these methods with all the Linux distros.

I recommend using the zip function to compress your files for its ease of use and portability. (Files zipped in Linux can be extracted using various tools on various platforms including Windows).

Below I have provided various “unzip” methods. The “right” unzip method depends upon the method used to zip the file. You can tell the zip method by the file extension (e.g., .zip, .tar, .gz, etc.)

Zipping Files Using ZIP

This Linux program is compatible with the zip program for Windows and most other operating systems. To zip files, first have the files uploaded to your server, then log into your account with SSH. Navigate to the directory where the files are that you want to zip (for instance by typing cd www then cd sounds to move to your /www/sounds directory). Then type:

zip myzip file1 file2 file3

This puts the files named file1, file2, and file3 into a new zip archive called myzip.zip.

Unzipping Files

Please note that the unzip method you use is defined by the filename you are trying to unzip. For example, if you are trying to unzip a file called file.tar – you would use the method described in “tar“. Files ending in .gzip or .gz need to be extracted with the method described in “gunzip“.

Zip

If you have an archive named myzip.zip and want to get back the files, you would type:

unzip myzip.zip

Typing zip or unzip by itself will give you a usage summary, showing nearly all the options available.

Tar

To extract a file compressed with tar (e.g., filename.tar), type the following command from your SSH prompt:

tar xvf filename.tar

Basically, this command means that you will see the file “explode”, so don’t worry when you see your screen scrolling wildly. It also means that you will see any errors in the archive.

Gunzip

To extract a file in Linux compressed with gunzip, type the following:

gunzip filename_tar.gz

then if you receive no errors, type:

tar xvf filename_tar
  • A Complete Introduction to Email Marketing
  • Publishing Your Website: Go-Live Checklist
  • 9 Web Hosting Mistakes You Don’t Want to Make
  • How to Make a Website on a Budget with Wordpre
  • How much Bandwidth and Disk Space do I need?
  • How to Choose the Perfect Domain Name
  • How to Speed Up Any Website (Especially WordPress)
  • Robots.txt File Explained: Allow or Disallow All or Part of Your Website
  • Understanding the Domain Name System
  • How to Fix Broken Images and Links on Your Website
Bluehost Special

 

Disclosure: This is an affiliate link. You can support us by clicking on it and buying web hosting.

HostingManual.net · Contact · Terms of Service · Affiliate Disclaimer · Review Policy · Sitemap (xml)

© 2025 Hosting Manual
  • Hosting Reviews
    • Bluehost Review
    • GreenGeeks Review
    • Inmotion Hosting Review
    • iPage Review
  • SLA & Uptime Calculator
  • Services
    • WordPress Migration Service
    • WordPress SEO Optimization
    • WordPress Speed Optimization
  • Domain Search