Sunday, 10 September 2017

File/Directory Compression and Archiving with Zip



Compressed files use less disk space and download faster than large, uncompressed files. You can compress Linux files with one of the popular open-source compression tool Zip.


Centos/RHEL can easily open zip files, but non-Linux operating systems may have problems. We are using zip tool to avoid compatibility problems exchange files with non-Linux users.

To compress a file with zip, type the following:

[root@linuxcnf ~]# zip –r filename.zip /path/to/file/or/directory
  adding: /path/to/file/or/directory (stored 0%)
[root@linuxcnf ~]#

In this example, filename represents the file that will create after compression and /path/to/file/or/directory represents the files/directory that we need to compress:
To extract the contents of a zip file, type the following:

[root@linuxcnf ~]# unzip filename.zip
Archive:  filename.zip
   creating: filename/
[root@linuxcnf ~]#

No comments:

Post a comment