How to create a ZIP file on Linux
There are a few good ways to create a .zip on Linux, and the best one depends on what you are packaging and the machine you are on. The `zip` command is the native default and the fastest once installed. A GUI archive manager (File Roller, Ark) is right for point-and-click on a desktop. An in-browser zip maker like ZipTool is for when you cannot install a package or want the files never uploaded. And worth knowing up front: on Linux, `.tar.gz` is more idiomatic than `.zip` — more on that below.
This page covers each path honestly. The terminal and GUI cover most cases; the browser path is the no-apt-install, no-upload alternative that also lets you build the archive and immediately preview what is inside it.
Method 1 — Create a zip with the `zip` command
The zip utility creates standard .zip archives from the terminal. It may already be installed; if not, your package manager adds it in one command. It is the right default when you are on the terminal or scripting.
- Install it if missing. Debian/Ubuntu:
sudo apt install zip. Fedora/RHEL:sudo dnf install zip. Arch:sudo pacman -S zip. - Zip a folder (recursive):
zip -r archive.zip folder/. The-rwalks the folder and keeps subfolder paths intact, so extracting later reconstructs the tree. - Zip specific files:
zip archive.zip file1.txt file2.txt. - Exclude files:
zip -r archive.zip folder/ -x "*.log"skips patterns you name.
Method 2 — Create a zip with a GUI archive manager
On a desktop, you do not need the terminal. Open the archive manager, choose New Archive, pick .zip as the format, and drag files or folders in; or right-click a folder in the file manager and choose Compress, then select .zip.
- GNOME uses File Roller (often labeled "Archive Manager"), which can create
.zip,.tar.gz, and.7z. - KDE Plasma uses Ark with the same options.
- Both let you set a password (encryption) and choose the compression level from a dialog.
Method 3 — Create a zip in your browser (no install, no upload)
When you cannot (or do not want to) install a package — a server without root, a shared machine, a minimal container — build the zip in the browser instead. Open ZipTool, click Create zip, add your files or a whole folder to the dropzone, name the archive, and click Create. Compression runs entirely in your browser tab and the .zip downloads locally; nothing is uploaded.
A useful extra: leave "open in workspace" checked and the freshly built zip loads straight into the viewer, so you can browse and preview exactly what you just packaged before sending it anywhere. There is no account and no upload queue, because there is no backend doing the work.
tar.gz is more idiomatic on Linux
A honest note worth making: on Linux, .tar.gz (a tar archive compressed with gzip) is the more traditional, more common format for bundling files — source tarballs, backups, and most Linux software distributions ship as .tar.gz rather than .zip. The command is tar -czf archive.tar.gz folder/ (create, gzip, file) and tar -xzf archive.tar.gz to extract. .zip is the better choice when the archive is going to Windows or macOS users (it opens natively everywhere) or when you specifically need the zip format; .tar.gz is the better choice for Linux-to-Linux packaging.
ZipTool handles both: it creates a zip online in the browser, and it can also convert and read .tar.gz natively. For the format background, see archive file formats.
Which method should you use?
A quick rule of thumb:
- Use `zip -r` for speed, scripting, and any time you are already on the terminal. It is the Linux default for producing a
.zip. - Use a GUI archive manager (File Roller, Ark) on a desktop when you want point-and-click and a password dialog.
- Use the browser tool when you cannot install a package, want the files never uploaded, or want to build the zip and preview it immediately.
- Use `tar -czf` (`.tar.gz`) when the archive is Linux-to-Linux and you want the idiomatic format; use
.zipwhen it is going to Windows or macOS.
Frequently asked questions
How do I create a zip file on Linux?
The standard way is the zip command: install it if missing (sudo apt install zip), then zip -r archive.zip folder/ to zip a folder recursively. On a desktop, right-click a folder and choose Compress, or use File Roller (GNOME) / Ark (KDE). With no install at all, use the in-browser zip maker — it needs no package and uploads nothing.
How do I zip a folder on Linux and keep its structure?
Use the recursive flag: zip -r archive.zip folder/. The -r walks the folder and stores subfolders with their relative paths, so extracting later reconstructs the original tree instead of a flat list. The browser tool also preserves folder structure when you use Add folder.
`zip: command not found` — how do I install it?
Install the zip package: sudo apt install zip (Debian/Ubuntu), sudo dnf install zip (Fedora/RHEL), or sudo pacman -S zip (Arch). If you cannot install a package, build the zip in your browser with ZipTool instead — no install, no upload.
Should I use zip or tar.gz on Linux?
For Linux-to-Linux packaging, .tar.gz is more idiomatic (tar -czf archive.tar.gz folder/). Use .zip when the archive is going to Windows or macOS — it opens natively on both — or when you specifically need the zip format. ZipTool can create a .zip and also read .tar.gz in the browser.
Does the browser zip maker upload my files?
No. Compression runs entirely in your browser tab and the .zip is produced locally; your files are never transmitted to a server, stored, or handed to a third party. Confirm it in DevTools (the Network tab shows no upload of your files) and by building a zip with the internet disconnected, which still works.