Find the Best Cosmetic Hospitals

Explore trusted cosmetic hospitals and make a confident choice for your transformation.

“Invest in yourself — your confidence is always worth it.”

Explore Cosmetic Hospitals

Start your journey today — compare options in one place.

zip CLI Cheatsheet for DevOps (Clarifying the Classic “WinZip Commands” Post)

Originally published on 2009-06-20; fully revised and updated.

This guide is for engineers who use command-line archiving in build scripts, release packaging, and backup workflows. You will learn the core zip options from the original post, how similar flags differ, and safe patterns for CI/CD usage.

zip command-line option list from original post

What this cheatsheet actually covers

The original article title references WinZip, but the option set shown is the classic zip command syntax (for example -u, -f, -r, -T). This rewrite keeps that option set and organizes it for practical use. Source post: WinZip commands Web References & Cheatsheet.

Command format and default behavior

Per the original post, the default action is to add or replace entries in a zip file from the provided file list. The list may include the special name - to read from standard input. If both zipfile and list are omitted, input is read from stdin and written to stdout.

zip [options] zipfile [list...]Code language: CSS (css)

Core flags by job

FlagBest used forWhat it does
-uIncremental updatesAdds new files and updates changed files.
-fFreshening existing archivesUpdates only files already present in the archive.
-dCleanupDeletes matching entries from the archive.
-mMove-then-clean workflowsMoves files into archive and deletes originals.
-rDirectory treesRecurses into subdirectories.
-jFlat archive layoutStores files without directory paths.
-i / -xInclusion/exclusion controlInclude only matching names or exclude matching names.
-0 / -1 / -9Compression tuningStore only, faster compression, or better compression.
-q / -vOutput verbosityQuiet mode for scripts or verbose mode for diagnostics.
-TValidationTests archive integrity.
-F / -FFRecovery attemptsAttempts to fix damaged archives (-FF is more aggressive).

Flags that are easy to confuse

Similar flagsKey differenceTypical choice
-u vs -f-u adds new files and updates changed files; -f updates only existing archive entries.Use -u for incremental build artifacts; use -f for strict refresh.
-r vs -j-r walks directories; -j strips stored directory names.Use -r for reproducible folder structure; use -j only when flattening is required.
-i vs -x-i is allow-list behavior; -x is block-list behavior.Prefer -i for tighter artifact control in CI.
-0 vs -9-0 stores without compression; -9 maximizes compression effort.Use -0 for already-compressed binaries; -9 for text-heavy artifacts.
-q vs -v-q reduces log noise; -v increases diagnostics.Use -q in stable pipelines and -v when debugging.

Archive workflow for CI/CD

flowchart TD
    A[Select files] --> B[Apply include exclude rules]
    B --> C{Archive exists}
    C -- no --> D[Create archive]
    C -- yes --> E[Update or freshen]
    D --> F[Test integrity]
    E --> F
    F --> G{Integrity ok}
    G -- yes --> H[Publish artifact]
    G -- no --> I[Repair or rebuild]

Practical command examples

Create a recursive release archive with higher compression

zip -r -9 release.zip dist/

Update an existing archive with only new or changed files

zip -u release.zip dist/

Freshen only files that already exist in the archive

zip -f release.zip dist/

Package selected logs while excluding unwanted files

zip -r logs.zip /var/log -i "*.log" -x "*.gz" "*.old"Code language: JavaScript (javascript)

Read file names from stdin

find dist -type f | zip artifacts.zip -@

Test archive integrity before publishing artifacts

zip -T artifacts.zipCode language: CSS (css)

Best practices and common pitfalls

  • Confirm your actual binary and supported flags with zip -h on the target host.
  • Quote wildcard patterns ("*.log") so your shell does not expand them unexpectedly.
  • Run -T integrity checks in CI after archive creation.
  • Use -m carefully because it deletes source files after archiving.
  • Avoid -j unless you explicitly want to drop directory paths (name collisions can occur).
  • Use -q for stable pipelines and switch to -v when debugging failures.

Find Trusted Cardiac Hospitals

Compare heart hospitals by city and services — all in one place.

Explore Hospitals
I'm Rajesh Kumar, a DevOps, SRE, DevSecOps, Cloud, and Platform Engineering expert passionate about sharing practical knowledge, real-world experiences, and industry best practices. I have worked at Cotocus and regularly write about technology, travel, investing, health, product reviews, and digital marketing through my various platforms. I publish technical articles at DevOps School, travel stories at Holiday Landmark, stock market insights at Stocks Mantra, health and fitness guidance at My Medic Plus, product reviews at TrueReviewNow, and SEO and digital marketing strategies at Wizbrand.

Related Posts

4 Open Source Alternatives to Slack for Team Chat: IRC, Let’s Chat, Mattermost, and Rocket.Chat

If you want Slack-like team communication with more control, these four open source options are a practical starting point. This guide compares their strengths, trade-offs, and how to run a short technical pilot.

Read More

jstack Utility Deep Dive: JVM Thread Dumps, Deadlocks, and Mixed Stacks

This guide explains how to use jstack to diagnose JVM hangs and deadlocks, including forced dumps, core-file analysis, and mixed Java/native stack traces. It also clarifies where jcmd fits in modern JDK 8+ troubleshooting guidance.

Read More

Open Source Scanning Software: Evaluate Legacy Tools and Build a Modern SCA Workflow

The original post listed several tool names but no implementation guidance. This revised guide explains what open source scanning means in DevSecOps, how to interpret those legacy names, and how to implement a practical CI scanning workflow.

Read More

Lyca Mobile USSD Shortcuts: Check Balance and Data Balance Quickly

Use these Lyca Mobile USSD shortcuts to check your prepaid balance and remaining data in seconds. This updated reference includes quick steps, a workflow diagram, and troubleshooting guidance.

Read More

Single Sign-On Implementations: Practical Comparison and Evaluation Guide

This guide expands a short 2015 link list of SSO tools into a practical DevOps reference. You will learn how SSO flows work, how to compare implementations, and how to validate integrations with real commands.

Read More
Subscribe
Notify of
guest
1 Comment
Newest
Oldest Most Voted
Jason Mitchell
Jason Mitchell
3 months ago

In real-world automation, the bigger challenge is usually not creating an archive but managing what happens around that process. For example, when compression jobs become part of backup or deployment workflows, teams need to define retention policies, handle large file processing efficiently, and understand the impact on storage and network usage. It is also important to consider how these scripts behave during failures, such as interrupted transfers or partial archives, and how teams can quickly identify and recover from such situations. These operational details often determine whether a simple command-line utility can reliably support production workflows at scale.

1
0
Would love your thoughts, please comment.x
()
x