0
0
Linux CLIscripting~15 mins

zip and unzip in Linux CLI - Mini Project: Build & Apply

Choose your learning style9 modes available
Zip and Unzip Files Using Linux CLI
📖 Scenario: You have a folder with several text files. You want to compress these files into a single zip archive to save space and share easily. Later, you want to extract the files from the zip archive to access them again.
🎯 Goal: Learn how to use the zip command to compress files into a zip archive and the unzip command to extract files from the archive using Linux command line.
📋 What You'll Learn
Use the zip command to create a zip archive
Use the unzip command to extract files from the archive
Work with exact file names and archive names as specified
💡 Why This Matters
🌍 Real World
Compressing files saves disk space and makes it easier to share multiple files as one package.
💼 Career
Many IT and scripting jobs require managing file archives efficiently using command line tools.
Progress0 / 4 steps
1
Create sample text files
Create three text files named file1.txt, file2.txt, and file3.txt with any content using the echo command.
Linux CLI
Need a hint?

Use echo "text" > filename to create a file with text content.

2
Set the zip archive name
Create a variable called archive_name and set it to my_files.zip.
Linux CLI
Need a hint?

Assign the string my_files.zip to the variable archive_name without spaces around the equals sign.

3
Create a zip archive with the files
Use the zip command with the variable archive_name to compress file1.txt, file2.txt, and file3.txt into the zip archive.
Linux CLI
Need a hint?

Use zip "$archive_name" file1.txt file2.txt file3.txt to create the archive.

4
Extract files from the zip archive
Use the unzip command with the variable archive_name to extract the files from the zip archive.
Linux CLI
Need a hint?

Use unzip "$archive_name" to extract the files.