- Zip Command
- How to zip files
- How to zip directory / directories
- How to Test if a ZIP File is Valid
- How to unzip a zip
- How to unzip a zip to a different directory
zip OPTIONS ARCHIVE_NAME FILES
To zip one or more files
zip archive-name.zip filename1 filename2 filename3
Create a zip archive of a directory including the content of sub-directories. The -r option allows to traverse the whole directory structure recursively:
To zip one directory including sub-directories.
zip -r archive-name.zip directory-name
To add multiple files and directories in the same archive
zip -r archive-name.zip directory-name1 directory-name2 file1 file2
How to Test if a ZIP File is Valid
unzip -t archive-name.zip
This is useful if you think the zipped file has been damaged or corrupted.
To extract a zip file in the same directory
To extract a zip file to a different directory
unzip -d archive-name.zip /path-to-unzip
The –d switch tells the system to put the unzipped files somewhere else.