How to Create ZIP Files on Linux

How to Create ZIP Files on Linux

by | Sep 10, 2024 | Useful Tech

Want to compress multiple files and folders in a single archive and share it to boot? Find out here how to create ZIP files (as well as TAR.XZ files) on Linux using Gnome, KDE and the command line.

First, Read the Full-Weight Manual

The majestic Boeing 747 leapt off runways around the world in the 1970s in its classic “dash 100” incarnation with a maximum payload of 76.28 tons.

The intricate jumbo jet’s documentation was counted, I have been told, in tens of thousands of pages—three thousand of them! That made for some 31 million pages of diagrams, charts and instructions.

Now, if we assume 5.5 grams for an A4-sized page that documentation weighed about… 86.49 tons.

Let’s hope the printers were able to fit 2 pages on 1—or the documents were compressed in some other fashion:

How to Create ZIP Files on Linux

Using Gnome

Time needed: 1 minute

To archive files and folders in a compressed ZIP file using Gnome Files on Linux:

  1. Open Files.

    Here’s how: Press Super (usually the Windows or Command key), start typing files and open the Files application.
    Keyboard shortcut: You can set up a keyboard shortcut for launching Gnome Files.

  2. Go to the directory that contains the files and folders you would like to compress to a ZIP file.

    Here’s how: You can use the sidebar to navigate or type the path to the directory in the location bar at the top of the Files window.

  3. Highlight all the documents and folders you want to include in the ZIP file.

    Here’s how: You can draw an outline over the desired files to make a selection.
    Add and subtract: Hold down Ctrl while you click a file or folder to toggle its inclusion in the selection.
    Everything: Press Ctrl A to select everything in the current directory.

  4. Click on one of the files or folders with the right mouse button.

  5. Select Compress… from the context menu that has opened.

    Select “Compress” in Files to create a ZIP file with Gnome on Linux

  6. Type the name you would like to use for the file under Archive name.

  7. Select .zip as the extension.

    Other formats: You can also use 7z (7-Zip) or tar.xz (XZ compression).

  8. Click Create.

    Enter the desired name for the ZIP file and click “Create”

On Windows? How to Create a ZIP File in Windows

Using KDE

To crate a ZIP file archive using the KDE Plasma desktop:

  1. Make sure the Ark compression utility is installed.
    No Ark: Ark adds capabilities for compressing to KDE Dolphin; without it, you can resort to compressing using a terminal—see below.
  2. Open the Dolphin file browser.
  3. Go to the folder that contains the files you want to compress.
  4. Highlight all the files and folders you want to add to the ZIP file.
  5. Click on one of the files or folders with the right mouse button.
  6. Select Compress | Here as “Archive.zip” from the context menu that has appeared.
    Other name: You can change the name afterwards or resort to opening more compression options.
    Other options: Select Compress | Compress to… for additional options including compressing to the highly efficient TAR.XZ, for example, which can be extracted on Windows 11 and macOS in addition to Linux.
    Compress folders into a ZIP file using KDE Dolphin

Why ZIP? How to Attach and Send a Folder by Email in Gmail

Using a Terminal

To create a ZIP file on Linux using a terminal prompt:

  1. Open your preferred terminal application.
    Here’s which: Launch Console on Gnome, for example, Konsole on KDE or Xterm if all else fails.
  2. Typically, navigate to the directory that holds the files you want to compress.
    Here’s how: Type cd  followed by the path; ~ (tilde) stands in for your home directory.
    Example: cd ~/Documents will take you to your account’s Documents folder.
  3. Type zip -r <filename> * to compress the complete current folder including all folders under it and their files to a ZIP file called <filename>.zip.
    Here’s why: The option -r makes zip traverse the directory tree under the current one; * selects all files (excluding hidden files whose name starts with a dot).
    Specific files: You can also specify a list of files to compress, of course (without the -r option) or use shell pattern matching to include all files of a specific type, for example in the ZIP file.
    Example: The command zip ladedu *.pdf La\ De\ Du/*.pdf will create a ZIP file called ladedu.zip that contains all PDF files in the current directory and in the folder called La De Du that’s in the the current directory.
  4. Press Enter.
    Create a ZIP file on the Linux command line using zip

Also on the command line: How to Zip Files on a Mac (without “__MACOSX”)

How to Create ZIP Files on Linux: FAQ

Can I open ZIP files created on Linux on other operating systems?

Yes.

ZIP files created with the Linux desktops and zip on the command line can be opened on Mac and Windows just fine, as can 7-Zip, bzip2 and TAR.XZ files, for example.

(How to create ZIP files on Linux tested with Gnome 46 and KDE Plasma 6.1; first published September 2024)

Home » Useful Tech » How to Create ZIP Files on Linux