Sunday, February 20, 2011

Opening/Creating .zip files in linux

Opening
To extract contents of abc.zip (keeping original zip file) --- unzip abc
To just list the contents --- unzip -l abc
To extract a specific file def.txt --- unzip -p abc def.txt > mydef.txt (where def.txt was listed in previous step)

Creating
To create abc.zip (keeping original files) --- zip abc def.txt xyz.txt ...
To zip a directory /path/to/dir1 --- cd /path/to; zip -r abc dir1
To add a file to existing zip file abc.zip --- zip /path/to/abc.zip lmn.txt (Do not give /path/to/lmn.txt)

No comments:

Post a Comment