Link to home
Start Free TrialLog in
Avatar of TotallyMe
TotallyMe

asked on

Create zip file in Ubuntu from command line

How can I create a Zip file in Ubuntu from the command line? I can already create tarballs but can't seem to create zips.
ASKER CERTIFIED SOLUTION
Avatar of torimar
torimar
Flag of Germany image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of nbthanh
nbthanh

If you want to work with zip files in Ubuntu command line interface, you will need these commands: zip and unzip.
Zip

To install zip if you dont already have it, do this

sudo apt-get install zip

The simplest way to create a zip file (archive) is

zip myzipfile.zip file1 file2 file3 ...

Where myzipfile.zip is the file (zip archive) you are creating and file1, file2, file3, and so on, are the files you are including in that archive. So lets say you need to create a zip file of your resumé which is in different file formats, you would something like

zip myresume.zip resume.odt resume.pdf resume.doc resume.txt
Unzip

To unzip files, you need to have a command called unzip. To install unzip if you dont already have it, do this

sudo apt-get install unzip

The simplest way to extract all files from a zip archive is

unzip myzipfile.zip

Where myzipfile.zip is the file (zip archive) you are unzipping. So lets say you need to extract (unzip) a zip file of your resumé which contains different files, you would something like

unzip myresume.zip

You can find more detail here: http://codeghar.wordpress.com/2007/12/08/zip-files-in-ubuntu-cli/