This linux zip folder guide shows how to zip a folder on Linux: install Info-ZIP’s zip if needed, then run zip -r archive.zip foldername from the parent directory. Confirm with unzip -l archive.zip and du -sh archive.zip. Success means the archive opens elsewhere and contains the files you intended—not accidental parent paths or unwanted secrets.
Shortest path: sudo apt install zip unzip → cd ~/tmp-practice → zip -r project.zip project/ → unzip -l project.zip | head. Extract later with linux unzip.

To locate files before you create, copy, move, or delete them, see how to find files in Linux.
Install zip
sudo apt update
sudo apt install -y zip unzip
zip -v | head -n 2
Package names are usually zip and unzip on Ubuntu/Debian. Other distros use their package managers similarly. Do not confuse zip with gzip (single-file compression) or tar (common for .tar.gz).
Basic: Zip a Whole Directory
cd /path/to/parent
zip -r project.zip project/
ls -lh project.zip
The -r flag recurses into subfolders. Running from the parent keeps paths inside the archive shorter and clearer. Ask Ubuntu guidance often stresses controlling what relative paths get stored—zipping from too high in the tree embeds long useless prefixes.
Exclude Hidden Files (Common Ask)
A classic Ask Ubuntu question is how to zip a directory without hidden files. One practical approach uses exclude patterns:
zip -r project-clean.zip project/ -x "project/.*" "project/*/.*" "*/.*"
Tune excludes to your tree. Always verify with unzip -l so you did not exclude required config that happens to start with a dot (for example .env.example you actually need).
Zip Without an Extra Parent Folder
If recipients complain the archive contains project/project/... nesting, change into the folder and zip contents:
cd project
zip -r ../project-flat.zip .
cd ..
unzip -l project-flat.zip | head
Ask Ubuntu threads about “without including parent directory” revolve around this cwd choice. Decide whether extractors should get a single top-level folder (usually friendlier) or loose files.
Useful Options
-rrecurse directories-qquieter output-x patternexclude-eencrypt (password prompt)—share passwords out of band-uupdate existing archive entries
zip -r -q backup.zip data/ -x "*.tmp" -x "*/cache/*"
What Not to Zip Blindly
- Secrets (
.ssh, raw.envwith production keys) - Huge caches (
node_modules, build artifacts) unless required - Virtual disk images you can transfer more efficiently otherwise
Check size first: du -sh folder. If the folder is enormous, consider splitting, using tar+compression, or syncing with rsync instead of emailing a giant zip.
Verify the Archive
unzip -t project.zip
unzip -l project.zip | head -n 40
du -sh project.zip project/
- Test integrity with
unzip -t. - List entries for sanity.
- Spot-extract into a temp dir (unzip guide).
Update or Re-Zip
zip -u project.zip project/changed-file.txt
For major tree changes, recreating the archive is often clearer than long update sessions. Delete the old zip only after the new one tests clean.
CI pipelines should fail if zip returns non-zero or if unzip -t fails on the artifact. Publishing a corrupt zip wastes everyone’s afternoon. Store checksums (sha256sum project.zip) beside releases when auditors care about integrity.
GUI archive managers exist on desktop Linux, but servers and containers usually only have the CLI. Learn zip/unzip in the terminal so SSH sessions and Docker images do not block you. File managers are fine for occasional desktop use; automation still needs commands.
When zipping logs for support tickets, redact secrets first. Prefer copying a scrubbed tree into /tmp/support-bundle, zip that, then delete the scrubbed tree. Never zip an entire home directory “just in case”—you will leak browser data and SSH keys.
Scripting Tips
Use dated names: project-$(date +%F).zip. Write archives to a dedicated folder, then copy to USB or object storage. Fail the script if zip exits non-zero.
On Linux, zip a folder with zip -r from the right working directory, exclude what you must, verify with unzip -l/-t, and keep passwords and paths under control.
Practice in ~/tmp-practice: create a small folder tree, zip it, move the archive aside, unzip into a fresh directory, then compare with diff -r. That drill beats learning on production home directories. Repeat until the flags feel boring.
Install tools from your distro packages (sudo apt install zip unzip on Debian/Ubuntu). Prefer official repos over random binaries. Check versions with zip -v and unzip -v when a flag behaves differently than a blog post from 2014. Document the package version in team runbooks when CI depends on specific behavior.
Quote paths with spaces. Prefer absolute destinations when scripting. Never unzip as root into system paths “to make permissions easier.” Own the extract directory as your normal user whenever possible. Root extractions create root-owned trees that juniors then “fix” with reckless chmod -R 777.
Measure before and after with du so large archives do not fill the disk mid-job. If space is tight, extract to another mount or clean caches first—do not discover No space left on device halfway through a multi-gigabyte unzip. Free space checks belong in the same checklist as the unzip command itself.
Archives often carry DOCX, XLSX, and PDF hand-offs. After you zip or unzip on Linux, open critical office files once to confirm nothing corrupted in transit—then keep working copies outside the archive when collaborators need ongoing edits.
On WSL, keep large zip/unzip work inside the Linux filesystem (~/projects) for speed; copy finished archives to /mnt/c only when Windows users need the file. Cross-filesystem I/O is slower and more permission-noisy. If Windows Defender locks a file mid-extract, close Explorer windows on that path and retry.
Security habit: treat unexpected archives as untrusted. List contents (unzip -l) before extracting, and extract into a new empty folder so a malicious archive cannot overwrite ~/.ssh via tricky relative paths. Delete suspect trees with care using rm / rmdir workflows after inspection. Do not run post-extract install scripts you have not read.
Keep zip and unzip as a pair in your notes—create archives for sharing, extract archives for use, verify, then archive or delete leftovers. That loop prevents “Downloads full of half-extracted folders” entropy and keeps disks predictable for the next incident.
When teaching teammates, demonstrate one good path end to end: install packages, zip with excludes, list, extract to -d, test, then clean up. Watching the whole loop once prevents a month of fragmented Stack Overflow pastes that disagree with each other.
Name archives with purpose and date: invoice-export-2026-07-23.zip beats final-final2.zip. Clear names reduce accidental double-sends and make log lines searchable months later when someone asks which bundle went to the client.
If compression ratio looks worse than expected, check whether you zipped already-compressed media (JPG, MP4, DOCX). Those formats rarely shrink much; the win is packaging, not size. For text-heavy trees, zip still helps network transfer and keeps a single attachable artifact.
After Zipping Folders: Ship Manifests with the Archive
zip -r packages a tree for transfer. Recipients still ask what is inside, what was excluded, and how to restore it—answers that belong in a short document beside the archive.
WPS Office for Linux covers that companion file: Writer for manifests, Spreadsheet for file lists, and PDF when the inventory should not change in transit.

| What you need next | What WPS gives you |
|---|---|
| Attach a readable manifest to a zip handoff | Strong .docx / .xlsx / .pptx layout fidelity when files move between Linux, Windows, and macOS |
| One place for notes, sheets, slides, and PDFs | Free core suite: Writer, Spreadsheet, Presentation, plus PDF view/edit/convert tools |
| A familiar desktop UI for switchers | Ribbon-style apps with a lighter footprint than many heavy suites |
| A trusted install path | Official DEB (Ubuntu/Debian/Mint) and RPM packages from the vendor |
Download from the official WPS Office for Linux download page, install with sudo apt install ./wps-office_VERSION_amd64.deb, and keep a DOCX/PDF checklist next to the .zip you just built.
FAQ
zip vs tar.gz?
Zip is universal with Windows/macOS users. tar.gz is common for Linux-native backups. Choose based on recipients. If both sides are Linux servers, tar.gz (or tar.xz) often preserves ownership metadata better; if one side is a non-technical Windows user, zip usually wins for “double-click and open.”
Why is my zip path too deep?
You started zip too high in the directory tree. cd closer to the folder you mean. Listing with unzip -l immediately shows whether entries look like home/you/projects/... instead of project/...—fix by recreating the archive from the correct parent.
Can I zip multiple folders?
zip -r bundle.zip folderA folderB file.txt
Order arguments carefully: archive name first, then inputs. A typo that swaps names can overwrite a folder name you meant as a source.
How do I exclude node_modules?
zip -r app.zip app/ -x "app/node_modules/*"
Exclude patterns are easy to get wrong—verify with unzip -l that node_modules is gone before uploading. Also exclude .git, build caches, and .env files that should never leave the machine.
Does zip preserve permissions perfectly?
Zip has limits versus tar for Unix permissions/ownership. For system backups, prefer tar-based workflows. For sharing documents and source trees with mixed OS teammates, zip’s limitations are usually acceptable.
Password zip safe enough?
Traditional zip encryption is weak by modern standards. Prefer strong tools for sensitive data; never email passwords with the file. For regulated data, use your org’s approved transfer channel instead of “zip + password in Slack.”
Command not found: zip?
Install the zip package from your distro repositories. On minimal containers you may also need unzip separately even if you only plan to create archives—verification uses unzip.
How do I split a huge zip?
Use zip split options or alternative transfer methods; test reassembly before deleting sources. For very large datasets, rsync or object storage uploads are often healthier than email-sized zip thinking.
Zip is a sharing format first. Treat it like packaging: include what recipients need, exclude junk, label clearly, and verify before you hit send. That mindset matters more than memorizing every obscure flag in the man page.




