Zip and unzip in Linux We can use the commands to zip and unzip the files or folders in Linux. Zip and unzip and such useful commands. The usage of the commands are described below. Zipping Create a zip file for a single file zip targetZipFilename.zip filetoZip.txt Add multiple files to the new zipfile zip targetZipFilename.zip filetoZip-1.txt filetoZip-2.txt Note : We can use wildcards for the filenames as needed. Add a file to existing zip file zip -u existingZipFilename.zip filetoZip.txt Remove single file from a zip file zip -d existingZipFilename.zip filetoRemoveFrom Zip.txt Zip directories and the contents zip -r ZipFilename.zip ./FolderInPWDToZip Note : -r is for recursive file selection. To zip everything in the present working directory zip -r ZipFilename.zip ./* Unzipping The command without any arguments will unzip the contents to present folder. No additional folders will be created on extraction. Basic unzip unzip zippedFile.zip Extract to ...
Let's make things work!