0
0
Linux CLIscripting~5 mins

zip and unzip in Linux CLI - Cheat Sheet & Quick Revision

Choose your learning style9 modes available
Recall & Review
beginner
What does the zip command do in Linux?
The zip command compresses one or more files into a single archive file with a .zip extension. It helps save space and makes it easier to share multiple files together.
Click to reveal answer
beginner
How do you extract files from a .zip archive using the command line?
Use the unzip command followed by the archive name. For example, unzip archive.zip extracts all files from archive.zip into the current folder.
Click to reveal answer
intermediate
What option do you use with zip to include all files in a folder recursively?
Use the -r option with zip. For example, zip -r archive.zip foldername compresses the folder and all its contents, including subfolders.
Click to reveal answer
beginner
How can you list the contents of a .zip file without extracting it?
Use unzip -l archive.zip. This shows the list of files inside the archive without extracting them.
Click to reveal answer
intermediate
What happens if you try to unzip a file into a folder where files with the same names already exist?
The unzip command will ask if you want to overwrite each existing file. You can press y to overwrite or n to skip. Use the -o option to overwrite all without asking.
Click to reveal answer
Which command compresses files into a .zip archive?
Atar
Bunzip
Czip
Dgzip
How do you extract all files from archive.zip?
Azip archive.zip
Bunzip archive.zip
Ctar -x archive.zip
Dgzip -d archive.zip
What option with zip includes all files in folders and subfolders?
A-r
B-l
C-x
D-o
Which command lists files inside a zip archive without extracting?
Aunzip -l archive.zip
Bzip -l archive.zip
Ctar -t archive.zip
Dgzip -l archive.zip
How to overwrite files automatically when unzipping?
Aunzip -r
Bunzip -f
Czip -o
Dunzip -o
Explain how to create a zip archive of a folder including all its files and subfolders.
Think about compressing a whole folder recursively.
You got /4 concepts.
    Describe how to safely extract files from a zip archive and check what files are inside before extracting.
    Listing contents first helps avoid surprises.
    You got /4 concepts.