Zip and Unzip Command:
Zip and Unzip in Linux is the biggest burning issue which we can’t ignore as we know that Microsoft Windows has the Winzip program and many people finds it difficult to search any program in the application shortcuts to unzip or zip files on the Linux. But here we are to solve your problem. Linux has basically both the Zip and the unzip program. But these are not easily installed but you can install or zip and unzip these by simply following these easy steps.
Zip files in Linux:
First of all creates the data archive like .zip and then input all these files in the directory or current folder in it, but in the compressed form, simply input the
$ zip data *
Always remember there is not a need to sum or add the .zip extensions or may be a suffix because it adds automatically by the zip command. Please use the IS command to easily verify the latest zipped file. Type
$ Is
If you want and wishing to zip an entire file directory which also includes the subcategories then just simply follow these commands. Type
$ zip -r data *
Unzip files in Linux:
To do unzip to make extract of all the files of archived images.zip type in the running current folder directory and subcategories.
We may also easily test the images.zip by only printing a short or the summary text which is indicating whether this archive or folder is fully OK. Just type $ unzip –tq images.zip
If you want to extract all of the files which is mainly called the cv. doc and from the images.zip then simply type $ unzip images.zip cv .doc
Extract all of the files into the temp directory just type $ unzip images.zip -d /tmp
To get a list of all files from images.zip simply type $ unzip -l images.zip
Some examples of zip and unzip command :
1). zipping a file or folder :
-----
# zip archivename.zip file1 file2 folder1
------
2). zip individual files to a zip archive :
-----
# zip xyz.zip file1 file2 file3
------
3). zipping sub folders and files :
-----
# zip -r abc.zip image/
------
4). zip files which are not located in present directory :
-----
# zip -r /var/xyz.zip /home/hoststud/demo
------
5). To compress fast use -1 option and for compress better ratios use -9 :
-----
# zip -1 -r abc.zip image/
# zip -9 -r abc.zip image/
------
6). Exclude a file in a folder when compressing it :
-----
# zip -r abc.zip image/ -x image/bird/100pg.zip
------
7). List all the files stored in a zip file :
-----
# unzip -l xyz.zip
or
# less xyz.zip
or
# zipinfo -1 xyz.zip
------
8). Delete a file in an archive with out extracting entire zip file :
-----
# zip -d abc.zip path/of/the/file
------
9). To update a particular file which is modified :
-----
# zip -u abc.zip image/bird/parrot.doc
------
10). Update all the files in zip file if the original files are modified :
-----
# zip -fr abc.zip image/
------
11). unzip your files:
-----
# unzip xyz.zip
------
12). unzip to specific directory:
-----
# unzip xyz.zip -d /home/hoststud/demo
------
13). Extract specific file from an archive:
-----
# unzip abc.zip image/bird/parrot.doc
------
Zip and Unzip in Linux is the biggest burning issue which we can’t ignore as we know that Microsoft Windows has the Winzip program and many people finds it difficult to search any program in the application shortcuts to unzip or zip files on the Linux. But here we are to solve your problem. Linux has basically both the Zip and the unzip program. But these are not easily installed but you can install or zip and unzip these by simply following these easy steps.
Zip files in Linux:
First of all creates the data archive like .zip and then input all these files in the directory or current folder in it, but in the compressed form, simply input the
$ zip data *
Always remember there is not a need to sum or add the .zip extensions or may be a suffix because it adds automatically by the zip command. Please use the IS command to easily verify the latest zipped file. Type
$ Is
If you want and wishing to zip an entire file directory which also includes the subcategories then just simply follow these commands. Type
$ zip -r data *
Unzip files in Linux:
To do unzip to make extract of all the files of archived images.zip type in the running current folder directory and subcategories.
We may also easily test the images.zip by only printing a short or the summary text which is indicating whether this archive or folder is fully OK. Just type $ unzip –tq images.zip
If you want to extract all of the files which is mainly called the cv. doc and from the images.zip then simply type $ unzip images.zip cv .doc
Extract all of the files into the temp directory just type $ unzip images.zip -d /tmp
To get a list of all files from images.zip simply type $ unzip -l images.zip
Some examples of zip and unzip command :
1). zipping a file or folder :
-----
# zip archivename.zip file1 file2 folder1
------
2). zip individual files to a zip archive :
-----
# zip xyz.zip file1 file2 file3
------
3). zipping sub folders and files :
-----
# zip -r abc.zip image/
------
4). zip files which are not located in present directory :
-----
# zip -r /var/xyz.zip /home/hoststud/demo
------
5). To compress fast use -1 option and for compress better ratios use -9 :
-----
# zip -1 -r abc.zip image/
# zip -9 -r abc.zip image/
------
6). Exclude a file in a folder when compressing it :
-----
# zip -r abc.zip image/ -x image/bird/100pg.zip
------
7). List all the files stored in a zip file :
-----
# unzip -l xyz.zip
or
# less xyz.zip
or
# zipinfo -1 xyz.zip
------
8). Delete a file in an archive with out extracting entire zip file :
-----
# zip -d abc.zip path/of/the/file
------
9). To update a particular file which is modified :
-----
# zip -u abc.zip image/bird/parrot.doc
------
10). Update all the files in zip file if the original files are modified :
-----
# zip -fr abc.zip image/
------
11). unzip your files:
-----
# unzip xyz.zip
------
12). unzip to specific directory:
-----
# unzip xyz.zip -d /home/hoststud/demo
------
13). Extract specific file from an archive:
-----
# unzip abc.zip image/bird/parrot.doc
------