RSS

Tips n Trick data compression in Linux

This post, i will share about data compression in Linux. The first question, why we need to compress data?. My first answer is to backup data and can rezise the data to be small. so we can management our space hardisk. In Linux there are a lot of way to compress the data. we can use tar, zip or gzip. TAR:
1. tar -xzvf backup_20121217.tar.gz -C /home/rumahku/
the script want to extract the data commpression with gzip format in directori /home/rumahku
2. tar -xjvpf backup_20121217.tar.bzip2
the script want to extract the commpression data to current directory with bzip2 format and keep or preserve the owner and mode of file.
3. tar --exclude=tobackup/LOGS -czvpf tobackup_20121217.tar.gz tobackup/*
the script want to create data comppresion with preserve owner and exclude the LOGS directory with the name tobackup_20121217.tar.gz
4.tar -czvf tobackup_20121217.tar.gz ini.sh kamu.sh bajak.dmp
the script want to make compress data only particular files.
5. tar -tzvf tobackup_20121217.tar.gz
the script only list the file of comppresion data tobackup with the format gzip
6. tar -rzvf tobackup_20121217.tar.gz aku.php kamu.php
the script to add the file in tar.gz
6. tar -zvf tobackup_20121217.tar.gz --delete aku.php kamu.php
the script to delete aku.php n kamu.php the file in tar.gz i think only these scripts we usually use and must to know. ZIP/UNZIP:
1. zip tobackup ini.sh itu.sh
This script to make tobackup.zip withh contain ini.sh and itu.sh files
2. zip tobackup PROXY/* -x LOGS
This script to make tobackup.zip withh contain all of proxy files exclude the LOGS directory
3. zip -r tobackup /home/rumahku/logs
This script to make tobackup.zip from the directory logs
4. zip -P s3cr3t tobackup rumahku/*
This script to make passwork s3cr3t in the tobackup.zip
5. unzip -l tobackup.zip
This script just list the files inside tobackup.zip
6. unzip tobackup.zip
This script to normally unzip pigz pigz only can compress single file. if want compress folder, make it to be tar first and then gz with pigz
1. pigz -p 8 tobackup.log
this script using multi thread processor to gzip file. so it can run fast to compress it.
1. pigz -d -p 8 tobackup.log.gz
to extract the file with multi thread processing.

0 comments:

Posting Komentar

Please copy and share it, if it helps you
 
Copyright 2009 My Note All rights reserved.
Free Blogger Templates by DeluxeTemplates.net
Wordpress Theme by EZwpthemes
Blogger Templates