Windows Compress-Archive equivalent in Linux
Compresses files or folders into a standard ZIP archive.
Compress-Archive
zip -r archive.zip folder/
zip -r archive.zip folder/
zip -r archive.zip folder/
Overview
What this command does
On Windows, "Compress-Archive" is used to create a ZIP archive. On Linux, the closest practical mapping shown here is "zip -r archive.zip folder/". Compresses files or folders into a standard ZIP archive. This reference is grouped under File Management → Archives & Compression.
Windows → Linux context
What changes when you use this on Linux?
Equivalent task, different tool
Windows Compress-Archive maps to zip -r archive.zip folder/ for this task. Treat this as a workflow mapping rather than a character-for-character syntax translation.
Portable across the compared distros
The Debian/Ubuntu, Fedora and Arch rows use the same command in this mapping. Package availability or defaults can still vary, so check the installed tool version when an option behaves differently.
Command-specific caution
Existing archive entries may be updated rather than replaced. Delete the old archive first when you need a completely fresh result.
For the broader concept behind this mapping, read Linux filesystem for Windows users.
Practical tasks
Common use cases
Create a ZIP archive
Compresses files or folders into a standard ZIP archive.
zip archive.zip file.txt
Compress one file
zip -r project.zip project/
Compress a directory recursively
zip -9 -r backup.zip Documents/
Use maximum ZIP compression
Ready to run
Copyable Linux commands
Review paths, device names, package names and permissions before running any command.
zip archive.zip file.txt
zip -r project.zip project/
zip -9 -r backup.zip Documents/
Walkthrough
Examples with explanations
zip archive.zip file.txt # create an archive containing one file
zip -r project.zip project/ # archive a complete directory
zip -9 -r backup.zip Documents/ # use maximum compression
Reference
Common options and variations
| Command or option | Use |
|---|---|
zip archive.zip file.txt | Compress one file |
zip -r project.zip project/ | Compress a directory recursively |
zip -9 -r backup.zip Documents/ | Use maximum ZIP compression |
Distro differences
Debian/Ubuntu vs Fedora vs Arch
Debian/Ubuntu, Fedora and Arch all use "zip -r archive.zip folder/" for this mapping. The command syntax shown here is portable across the three rows, although installed versions and system defaults can still vary.
| Distribution | Package manager / base | Equivalent command | Difference to notice |
|---|---|---|---|
| Debian/Ubuntu | same command | zip -r archive.zip folder/ |
Same command on this distribution. |
| Fedora | same command | zip -r archive.zip folder/ |
Same command on this distribution. |
| Arch | same command | zip -r archive.zip folder/ |
Same command on this distribution. |
Important
What to watch out for
Keep learning