Install linux zip file

How to Zip and Unzip Files in Ubuntu 22.04 LTS Linux

This tutorial will help the users to learn the command to ZIP and unzip in Ubuntu Terminal. Zip is a command Archive format that can be used on almost all operating systems to use, especially on Windows. However, all Linux distros don’t have a tool to extract the Zip format files by default, for example, Ubuntu (especially the minimal installation). In such as case we manually have to install a command line tool to extract our files.

Steps to install and use Zip or Unzip in Ubuntu 22.04

1. Update Ubuntu 22.04

The Archive manager we are about to install is available through the default system repository and APT package manager. Therefore, before going further, let’s first run the system update command:

sudo apt update && sudo apt upgrade -y

2. Install ZIP & Unzip on Ubuntu 22.04 Linux

To create or unpack Zip archives under Ubuntu 22.04 Linux, you must first ensure that the required tool is available on the system. Although, generally ZIP and unzip tools come pre-installed however, if not then use the below-given command:

sudo apt install zip unzip

2. Zip Linux Command Syntax

Next, we should know what are options available to use with ZIP or Unzip Commands. Here is the List of the common ones along with their usage syntax.

zip [-options] [-b path] [-t mmddyyyy] [-n suffixes] [zipfile list] [-xi list] The default action is to add or replace zipfile entries from list, which can include the special name - to compress standard input.
If zipfile and list are omitted, zip compresses stdin to stdout. # Here are the options that we can use with the ZIP commands- -f freshen: only changed files -u update: only changed or new files -d delete entries in zipfile -m move into zipfile (delete OS files) -r recurse into directories -j junk (don't record) directory names -0 store only -l convert LF to CR LF (-ll CR LF to LF) -1 compress faster -9 compress better -q quiet operation -v verbose operation/print version info -c add one-line comments -z add zipfile comment -@ read names from stdin -o make zipfile as old as latest entry -x exclude the following names -i include only the following names -F fix zipfile (-FF try harder) -D do not add directory entries -A adjust self-extracting exe -J junk zipfile prefix (unzipsfx) -T test zipfile integrity -X eXclude eXtra file attributes -y store symbolic links as the link instead of the referenced file -e encrypt -n don't compress these suffixes -h2 show more help

Let’s see some common commands that will help us to use this tool for extracting archive files and repacking the ones we want.

Читайте также:  Пароль от пользователя root линукс

3. How to Zip a file or folder in Ubuntu 22.04

The syntax of the ZIP commands will always be the same even for Ubuntu and other Linux distros.

zip options archive.zip files and folders list

If the archive already exists, the files and folders are added to the archive or updated. The archive is not going to be replaced.

Add individual files to an archive:

zip archive-filename.zip file1 file2 (. )

With this command, an archive “archive-filename.zip” with the files “file1” and “file2” is created or updated in the current directory.

To add a folder to an archive:

zip -r archive-filename.zip folder1 folder2 (. )

This command creates an archive “archive-filename.zip” with the folders “folder1” and “folder2” including all subfolders and files in the current directory.

Create a Zip archive and delete the original files

With creating of Archive file you want to remove the original files or folders that have been used to create the ZIP archive file of yours, then use -m option. It is meant to move files permanently rather than copying them to the archive.

zip -m archive-filename.zip file1 file2

4. Removes/Delete folders and/or files from the Zip archive

zip -d archive.zip file1 file2 folder / * (. )

The command removes the files “file1” and “file2” as well as the folder “folder” & its contents from the archive “archive.zip”

Show more options:

Displays complete help with all available options.

5. Display the contents of the zip file on Ubuntu

This command shows the complete content of the archive “archive.zip”

6. Password-protected Linux ZIP file

Many times, we need protection for sensitive files or data while archiving them. Thus, if you want to create a Linux zip with a password then simply use -e option. With this, we can significantly improve the security of our zipped files.

zip -e archive.zip file1 file2

As you use -e parameter, the system will ask you to create a password for the files by entering it two times.

7. Unzip a file or folder on Ubuntu 22.04

Once you have learned the way to put your files and folder in a ZIP format archive on Ubuntu. Let’s see the way to extract the content of an existing ZIP file.

Читайте также:  Linux часу что это

Unpack the complete archive:

Unpacks the complete archive into the current directory.

Extract the archive to a specific location:

unzip archiv.zip -d /tmp/target

Extract the complete archive to “/tmp/target”

Extract only certain files or folders:

unzip archive.zip file1 folder1 file2 -d /tmp/target

-d stands for the directory.

Show more options:

Displays complete help with all available options.

unzipsfx options: -c, -p - Output to pipe. (See above for unzip.) -f, -u - Freshen and Update, as for unzip. -t - Test embedded archive. (Can be used to list contents.) -z - Print archive comment. (See unzip above.) unzipsfx modifiers: Most unzip modifiers are supported. These include -a - Convert text files. -n - Never overwrite. -o - Overwrite without prompting. -q - Quiet operation. -C - Match names case-insensitively. -j - Junk paths. -V - Keep version numbers. -s - Convert spaces to underscores. -$ - Restore volume label. 

8. Uninstall Zip & Unzip from Ubuntu 22.04

After some time if you don’t want this Archive manager in your Linux then here is the command to completely remove Zip & Unzip from your Ubuntu 22.04 along with their dependencies.

sudo apt autoremove --purge unzip zip

Ending note:

These were a few common ZIP and Unzip commands that we can use on Ubuntu 22.04 Linux operating system for packaging or unpacking archive files using the terminal.

Other Articles:

Leave a Comment Cancel reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Источник

How to Install Zip and Unzip in Linux

Zip is a command-line utility tool used for compressing files and folders. Compression of files & folders enables faster and more efficient transfer, storage, and emailing of files and folders. On the other hand, unzip is a utility tool that helps you decompress files and folders.

Benefits of zipping files:

  • Compressed/zipped files take up less disk space, leaving you with more space to work with.
  • Zipped files are easy to transfer including uploading, downloading, and attaching them on email.
  • You can easily decompress zipped files on Linux, Windows, and even mac.

In this topic, we focus on how you can install the zip and unzip utilities on various Linux distributions.

On this page:

Let’s now see how you can install these useful command-line utilities.

How to Install Zip/Unzip in Debian/Ubuntu/Mint

For Debian-based distributions, install the zip utility by running the command.

After installation, you can confirm the version of zip installed using the command.

For the unzip utility, execute a similar command as shown.

Again, just like zip, you can confirm the version of the unzip utility installed by running.

How to Install Zip/Unzip in RedHa/CentOS/Fedora

Just like on Debian distributions, installing zip and unzip utilities on Redhat distros is quite simple.

To install zip, simply execute:

For the unzip utility, install it by running:

How to Install Zip/Unzip in Arch/Manjaro Linux

For Arch-based distros, run:

How to Install Zip/Unzip in OpenSUSE

On OpenSUSE, run the command below to install zip.

Читайте также:  Dpkg remove linux image

And to install unzip, execute.

$ sudo zypper install unzip

For more information, read our article that shows how to create and extract a zip files in Linux.

Conclusion

For newer versions of Linux distros such as Ubuntu 20.04 and CentOS 8, the zip and unzip utilities already come pre-installed and you are good to go.

We covered how to install zip and unzip command-line tools on various Linux distributions and the benefits that come with compressing files.

Источник

How to Install Zip File in Linux

install zip file in linux

Sometimes you may need to install zip file in Linux if you want to install software using its source code, which is typically stored as zip, gzip or bz2 files. Linux allows you to install software from source code by installing zip files in Linux. Here’s how to install zip file in Linux.

How to Install Zip File in Linux

Here are the steps to install zip file in Linux.

1. Navigate to Folder with Zip File

Let’s say you have downloaded your zip file program.zip to /home/ubuntu folder. Open terminal and navigate to this location using CD command

$ cd /home/ubuntu $ ls $ program.zip

2. Unzip Zip File

Run the following command to unzip your zip file. If unzip is not installed on your Linux system, here are the steps to install unzip in Linux.

This will create a new folder named program in your present working directory extract all files & folders in program.zip to this new folder. Navigate to this folder and list its contents using LS command.

3. View Readme file

Most zip files have a README or INSTALL document that contains steps for installation. If they are displayed in the output of ls command view it using “more README” command. If these files are not present, then you can continue with the default installation steps.

4. Pre-Installation Configuration

Next, type the following command to initiate pre-installation configuration. Please make sure you are in unzipped folder (e.g /home/ubuntu/program) when you run this command.

Linux will check if dependencies and prerequisites are satisfied before you can proceed to compilation, and create a makefile file used for compilation.

5. Compilation

Run make command to compile the source code located in your unzipped folder.

Make command will run the instructions present in makefile file.

6. Installation

Finally we complete the installation using make install command. However, you need to switch to root user, using su command before you initiate installation. You will be asked to enter root password while doing so.

$ su Password: $ make install

You may see some messages on the screen as installation proceeds. In the end, you will mostly see the installation location of your program/software. If you see any prompts during installation, type ‘Y’ and press enter.

Hopefully, the above steps will help you install zip file in Linux.

Ubiq makes it easy to visualize data in minutes, and monitor in real-time dashboards. Try it Today!

Источник

Оцените статью
Adblock
detector