All File zipping commands in Linux

All File/Folder Zipping and unzipping commands in Linux


Command to create new zip file
the below command will create a new zip file names images.zip and add the image.jpg file to zip archive.
[root@server ~#]zip images.zip image.jpg 

How to add more than one files to a zip file
Will add the two files images.jpg and photo.jpg to images.zip
[root@server ~#]zip images.zip image.jpg photo.jpg   

Add a folder to zip file
Here all the contents in the "Datas" will add to the new zip file "Datas.zip"
[root@server ~#]zip -r Datas.zip Datas/

Add a file to an existing zip file
All the above commands can be used to add new file(s) or folder(s) to an existing zip file If the the specified zip file already exists.


How to Unzip a zip file
[root@server ~#]unzip images.zip          (unzips the contents to the current directory)


Unzip only a single file from the zip archieve. 
[root@server ~#]unzip images.zip photo.jpg     (unzip only photo.jpg from images.zip)


Unzip all the files to a specified directory
[root@server ~#]unzip images.zip -d /new/pics/


List contents in a zip file
[root@server ~#]unzip -l images.zip


Check compressing errors in zip file
[root@server ~#]unzip -tq images.zip

0 comments:

Related Posts Plugin for WordPress, Blogger...

 
Design by Free WordPress Themes | Bloggerized by Lasantha - Premium Blogger Themes | Bluehost Coupons