Sunday, February 20, 2011

Opening/Creating .zip files in linux

To extract contents of (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)

To create (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 --- zip /path/to/ lmn.txt (Do not give /path/to/lmn.txt)

No comments:

Post a Comment