How to Zip or Unzip Files on Debian 12

To zip or unzip files on Debian 12, you can use the zip and unzip commands. Here's how you can use them:

Install the ZIP and UNZIP

Step 1 : Open a terminal on your Debian 12 system.

Step 2 : Run the following command to update the package list:

Step 3 : Run the following command to install the zip and unzip packages:

Zip files

Step 4 : Navigate to the directory where the files you want to zip are located:

Step 5 : Use the zip command with the -r option followed by the name you want to give to the zip file (archive.zip) and the directory you want to include (archive/) to create a zip file containing all files and subdirectories within the archive/ directory. Run the following command::

Step 6 : The zip command with the -r option will recursively zip all files and subdirectories within the archive/ directory.

Unzip files

Step 7 : Navigate to the directory where the zip file you want to unzip is located. For example, if your zip file is in the /path/to/archive.zip directory, use the following command to navigate to that directory:

Step 8 : Use the unzip command followed by the name of the zip file you want to extract. For example, to extract the contents of the archive.zip file, run the following command:

Step 9 : The unzip command will extract the files and directories from the zip file in the current directory.

You have now installed the zip and unzip packages on your Debian 12 system and can use the zip and unzip commands to compress and extract files.