facebook youtube pinterest twitter reddit whatsapp instagram

Installing and Using (Zip & Unzip) In Ubuntu

Zip is a compression and file packaging utility, this is useful for packaging a set of files for distribution; for archiving files; and for saving disk space by temporarily
compressing unused files or directories.

Advantages of zipping:

  • You save storage space, leaving you with more space to work with
  • It is a compact and easy to transfer zip file, compared to unzip files
  • Zipping allows you to encrypt private data, helpful when sending such data over the internet.

Installing Zip in Ubuntu

sudo apt install zip

You can confirm zip version by running zip -v

Zipping File and Directories

To create a Zip archive in a specific directory the user needs to have write permissions on that directory. Note that, Zip doesn't support GNU/Linux-style ownership information. The extracted files are owned by the user that runs the command.

zip archive.zip filename1 filename2 filename3

The above command would compress the files, and store it in archive.zip

To zip a directory, you use the -r option:

zip -r archive.zip directory_name

You can also add multiple directory, and files, just do not forget the -r option.

Intsalling Installing Unzip in Ubuntu

 sudo apt install unzip

Likewise zip, you can also check the version by using unzip -v

Unzipping Files

When you use the unzip command without any option, it would extracts all files from the specified ZIP archive to the current directory, e.g

unzip classicpress.zip

Unzip a ZIP File to a Different Directory

To unzip a ZIP file to a specific directory, use the -d option:

unzip file.zip -d /path/to/directory