Monday, March 11, 2013

Compressing and Uncompressing files



 
 
This is a very simple, quick and easy way of compression (zipping) and decompression (extracting) files using command line.
 
First of all open terminal and go to the file folder.
Example:                                                                                                                                                                    
# cd /home/user (go to the directory file was downloaded)
# ls (to make sure package is there)
 
To combine multiple files and/or directories into a single file, use the following command:
  • tar -cvf your_file.tar inputfile1 inputfile2
To extract an archive created by tar:
  • tar -xvf your_file.tar

Extracting gz and bz2
  • bz2 files: tar -jxvf nome-do-arquivo.tar.bz2
  • gz files: tar -zxvf nome-do-arquivo.tar.gz

    *v is for verbose mode
 
To unzip files use:
  • unzip <file_name.zip>
To zip:
  • zip <new_zip_file_name> <file_to_zip>
Example: I want to zip “backtrack.txt”
# zip bacaktrack.zip backtrack.txt
 
For multiple files:
# zip output_file_name.zip backtrack(1).txt backtrack(2).txt backtrack(3).txt
 
The installation procedure for software that comes in tar.gz and tar.bz2 packages isn’t always the same, but usually it’s like this:
# tar xvzf package.tar.gz (or tar xvjf package.tar.bz2)
# cd package
# ./configure
# make
# make install
 
- if you got any doubts just ask

No comments:

Post a Comment