Living in the Shell #7; zip

babakks

Babak K. Shandiz

Posted on December 1, 2021

Living in the Shell #7; zip

zip 🗜ī¸

Creates ZIP archives.

Test archive integrity -T

zip -T x.zip
Enter fullscreen mode Exit fullscreen mode

Create/update zip archive (add/update file)

zip x.zip ~/.bashrc ~/.profile
Enter fullscreen mode Exit fullscreen mode

Creates x.zip archive file (if not exist) and adds .bashrc and .profile to it.

Add directory and its content -r

zip -r x.zip ~/Documents
Enter fullscreen mode Exit fullscreen mode

Without -r nothing is added.

Add all names except directories -D

zip -D x.zip ~/*
Enter fullscreen mode Exit fullscreen mode

Set password while add/update files -P

zip -P my-password x.zip file-to-add-or-update.txt
Enter fullscreen mode Exit fullscreen mode

Store-only mode (fast, without compression) -0

zip -0 x.zip ~/Pictures
Enter fullscreen mode Exit fullscreen mode

Fast compression mode (fast, low compression) -1

zip -1 x.zip ~/Pictures
Enter fullscreen mode Exit fullscreen mode

Ultimate compression mode (slow, maximum compression) -9

zip -9 x.zip ~/Pictures
Enter fullscreen mode Exit fullscreen mode

Delete file from archive -d

zip -d x.zip .bashrc
Enter fullscreen mode Exit fullscreen mode
💖 đŸ’Ē 🙅 🚩
babakks
Babak K. Shandiz

Posted on December 1, 2021

Join Our Newsletter. No Spam, Only the good stuff.

Sign up to receive the latest update from our blog.

Related