Monday, January 6, 2025
HomeQ&AZIP command in Linux with examples

ZIP command in Linux with examples

The zip command in Linux is used to compress files into a .zip archive. It can also be used to create compressed archives from multiple files and directories.

Basic Syntax:

zip [options] archive_name.zip file1 file2 …

Examples:

1. Compressing files:

zip archive.zip file1.txt file2.txt

This creates a archive.zip containing file1.txt and file2.txt.

See also  What is Something you Wear that Starts with the Letter M?

2. Compressing a directory:

zip -r archive.zip directory_name

This compresses the entire directory_name into archive.zip recursively.

3. Adding files to an existing archive:

zip archive.zip file3.txt

This adds file3.txt to the existing archive.zip.

4. Excluding files:

zip -r archive.zip directory_name -x “*.log”

See also  Is A 14kt Ge Ring Worth Anything?

This excludes .log files from being added to the archive.zip.

5. Password protection:

zip -e archive.zip file1.txt file2.txt

This creates archive zip and prompts you for a password.

 

 

 

RELATED ARTICLES
0 0 votes
Article Rating

Leave a Reply

0 Comments
Oldest
Newest Most Voted
Inline Feedbacks
View all comments
- Advertisment -

Most Popular

Recent Comments

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