Saturday, August 3, 2013

Compress and Uncompress Files

1) To compress files:
Examples:

tar cvf abc.tar a1.ps a2.tex adir/* # compress files to the file abc.tar
gzip -9 abc.tar /* # create abc.tar.gz file.
tar cvfz abc.tar.gz a1.ps a2.tex adir/* # directly create abc.tar.gz file
zip abc.zip a1.ps a2.tex adir/* # directly create abc.zip file

Note that -9 means the slowest compression method (best compression). By default, -6 is used. -1 means fastest compression method (less compression). The command zip is compatible with PKUNZIP on pc. Thus, the file abc.zip can be uncompressed by WinZip.

2) To uncompress files:
Examples:

tar xvf abc.tar # uncompress abc.tar file
gunzip abc.tar.gz # after uncompress, get abc.tar
tar xvfz abc.tar.gz #unzip and utar *.tar.gz file
unzip abc.zip #unzip .zip file

To view the content of the compressed file:
Examples:

tar tvf abc.tar
tar tvfz abc.tar.gz
unzip -l abc.zip

Related Posts:

  • Compiling and installing php 5.4.15 and httpd 2.4.4 from sourceHigh-performance PHP on apache httpd 2.4.x using mod_proxy_fcgi and php-fpmBài viết sau sẽ hướng dẫn các bạn build Linux Web server nâng cao bao gồm MySQL, php và apache(LAMP) từ source trên CentOS 6.41. Cài đặt MySQLXem chi … Read More
  • Compile php Get sources Go to PHP downloads, choose the version wanted and copy a link from a mirror you prefere. php-5.5.0 version will be used in current example. mkdir ~/compile && cd ~/compile wget http://lt1… Read More
  • Install phalcon with MAMP This is instructions on how to compile and install the phalcon extension on Mac OS X (Lion), along with command-line tools. Everything will be done through the terminal, except installation of Xcode and the comma… Read More
  • Installing latest version of MySQL via yum Usually when you try to install MySQL via yum, by default, the version that comes with your OS is always an old version (not the latest version available frommysql.com/downloads).In order to have the latest version, you alwa… Read More
  • ADD THÊM YUM REPOSITORY+Yum repository có cấu hình trong file /etc/yum.conf. Các file cấu hình bổ sung sẽ được đọc từ một thư mục khác, mặc định sẽ là /etc/yum.repos.d . Các bạn có thể list thư mục này ra xem nó có những repository nào.+Để sử dụng … Read More