Sunday, 26 April 2015

How To Zip and Unzip a Directory or File in Ubuntu



1)
Zip a directory/file using zip command

     anusree@anusree-Inspiron-5547:~$ zip -r zipped_my_music my_music
    adding: my_music/ (stored 0%)
    adding: my_music/zip_file (stored 0%)
    adding: my_music/zip_file~ (stored 0%)


zipped_my_music ---> Name of the compressed output zip file
my_music --->  Name of the directory or file to be compressed (zipped)

2)
Unzip or extract a zipped directory or file using unzip command

    anusree@anusree-Inspiron-5547:~$ unzip zipped_my_music.zip -d Desktop
    Archive:  zipped_my_music.zip
    creating: Desktop/
my_music/
    extracting: Desktop/
my_music/zip_file 
    extracting: Desktop/
my_music/zip_file~ 
-d Desktop --->  Directory to which to extract files