Close Menu
    Facebook X (Twitter) Instagram
    • About
    • Privacy Policy
    • Write For Us
    • Newsletter
    • Contact
    Instagram
    About ChromebooksAbout Chromebooks
    • Linux
    • News
      • Stats
      • Reviews
    • AI
    • How to
      • DevOps
      • IP Address
    • Apps
    • Business
    • Q&A
      • Opinion
    • Gaming
      • Google Games
    • Blog
    • Podcast
    • Contact
    About ChromebooksAbout Chromebooks
    Linux

    How To Use zip command in Linux

    Dominic ReignsBy Dominic ReignsJanuary 5, 2026Updated:January 8, 2026No Comments4 Mins Read
    Share
    Facebook Twitter LinkedIn Pinterest

    Zip packs files. Saves disk space. Makes sharing easy. The command works on Windows, Linux, Mac.

    Shrink large files for email. Mix files for backups. Cut file sizes. Add pass with flags.

    Example: unzip Command

    Pull files from ZIP. Pulls all files to current dir.

    Syntax:

    unzip file_name.zip

    Pull files from a pack:

    $ unzip case.zip

    Use ls.

    Syntax

    zip [flags] archive_name.zip file1 file2 dir/
    • zip: Make packed file
    • archive_name.zip: Name for your zip file
    • file1 file2: Files and dirs to pack

    Main zip Options

    1) -d Option (Drop File)

    Drop a file from a zip pack. No need to open it first.

    Syntax:

    zip -d file_name.zip files_name

    Drop a file from a pack with eight files:

    Run:

    $ zip -d myfile.zip hello7.c
    deleting: hello7.c
    Note: Use sudo if you see access errors.

    Check by opening the pack. Use ls to list files.

    2) -u Option (Add Files)

    Add new files to a pack. Swap old files with new ones.

    Syntax:

    zip -u file_name.zip files_name

    Add a new file to a pack:

    Run:

    $ zip -u myfile.zip hello9.c
    adding: hello9.c (packed 60%)

    Use vi to check it was put in.

    3) -m Option (Move Files to the Pack)

    Move files to a zip pack. Files are dropped from their old spot.

    Syntax:

    zip -m file_name.zip files_name

    Move all C files to a pack:

    Run:

    $ zip -m myfile.zip *.c
    adding: hello1.c (packed 60%)
    adding: hello2.c (packed 60%)
    Warning: Files are dropped after moving to the pack.

    Use ls to check.

    4) -r Option (Pack a Whole Folder)

    Pack a dir. All subdirs go in.

    Syntax:

    zip -r file_name.zip directory_name

    Pack a dir with all files:

    Run:

    $ zip -r myfile.zip project_folder/
    adding: project_folder/ (stored 0%)
    adding: project_folder/file1.c (packed 60%)
    adding: project_folder/subfolder/ (stored 0%)

    Check pack items with vi or unzip -l.

    5) -x Option (Skip Files)

    Skip files when making a pack.

    Syntax:

    zip -r file_name.zip . -x files_name

    Pack all files but skip some:

    Run:

    $ zip -r myfile.zip . -x a.txt
    adding: file1.txt (packed 60%)
    adding: file2.txt (packed 60%)

    Use -r flag adds files from all subdirs. The dot means this dir. Use -x flag skips the file named.

    6) -v Option (Show Info)

    Show info about file size.

    Syntax:

    zip -v file_name.zip file_name

    View info about all C files:

    Run:

    $ zip -v myfile.zip *.c
    adding: hello1.c (in=245) (out=128) (packed 60%)
    adding: hello2.c (in=312) (out=156) (packed 50%)

    Output shows file sizes before and after.

    Zip Command Options

    Use these flags to change how zip works. Each flag helps:

    Option What It Does Example Command
    -d Drop a file from zip pack zip -d myfiles.zip notes.txt
    -u Change the zip file with new files zip -u myfiles.zip report.txt
    -m Move files to zip and drop old ones zip -m myfiles.zip backup.txt
    -r Pack a dirs and all items zip -r myproject.zip myfolder/
    -x Skip files or dirs when packing zip -r myfiles.zip * -x *.log
    -v Show info while packing zip -v myfiles.zip sample.txt

    Zip in Linux lets you pack and shrink files. Use -r to pack dirs. Use -x to skip files. Use -u to add new files. Use -d to drop files from packs. Use -m to move files. Use -v flag shows you what goes. Use unzip to get files.

    Tip: You can mix flags. Try zip -rv myarchive.zip dir/ to pack dirs and see info at once.

    Common Querys

    Run zip archive.zip file1 file2 to pack files. Use zip -r archive.zip dir/ to pack dirs with all items inside.

    Zip packs and shrinks files in one step. Tar only packs files. It needs gzip or bzip2 to shrink them.

    Use zip -r archive.zip dir/ -x *.log to skip log files. Use -x flag lets you skip files that match a pattern.

    Use zip -u archive.zip newfile.txt to update archives. This adds new files or swaps old ones if they changed.

    Run zip -d archive.zip filename.txt to drop files. This drops the file from the archive with no pulling all files out.

    Share. Facebook Twitter Pinterest LinkedIn Tumblr
    Dominic Reigns
    • Website
    • Instagram

    As a senior analyst, I benchmark and review gadgets and PC components, including desktop processors, GPUs, monitors, and storage solutions on Aboutchromebooks.com. Outside of work, I enjoy skating and putting my culinary training to use by cooking for friends.

    Related Posts

    How to Restart NGINX on Your Linux Server

    January 30, 2026

    How To Install NPM Linux

    January 26, 2026

    How To Check Linux List Processes

    January 24, 2026

    Comments are closed.

    Best of AI

    Pephop AI Statistics And Trends 2026

    February 26, 2026

    Gramhir AI Statistics 2026

    February 24, 2026

    Poe AI Statistics 2026

    February 21, 2026

    Joyland AI Statistics And User Trends 2026

    February 21, 2026

    Figgs AI Statistics 2026

    February 19, 2026
    Trending Stats

    Chrome Incognito Mode Statistics 2026

    February 10, 2026

    Google Penalty Recovery Statistics 2026

    January 30, 2026

    Search engine operators Statistics 2026

    January 29, 2026

    Most searched keywords on Google

    January 27, 2026

    Ahrefs Search Engine Statistics 2026

    January 19, 2026
    • About
    • Tech Guest Post
    • Contact
    • Privacy Policy
    • Sitemap
    © 2026 About Chrome Books. All rights reserved.

    Type above and press Enter to search. Press Esc to cancel.