TAR ZIP STUFF:

Basic usage:
tar zxvf <filename>

Their are a whole lot of switches flags whatever but screw them.
---------------------------------------------------------------------------------------------

If a file is tar'ed and gzip'ed, it is unpacked by running either one of the following two commands, depending on the filename:
tar xvzf filename.tar.gz
tar xvzf filename.tgz

If a file is tar'ed and bzip2'ed, it is unpacked by running:
bzcat filename.tar.bz2 | tar xv

Some tar programs (most of them nowadays but not all of them) are slightly modified to be able to use bzip2 files directly using either the I, the y or the j tar parameter, which works the same as the z tar parameter to handle gzip archives. The above construction works no matter how your host system decided to patch bzip2. If a file is just tar'ed, it is unpacked by running:
tar xvf filename.tar

If a file is gzip'ed, it is unpacked by running:
gunzip filename.gz

If a file is bzip2'ed, it is unpacked by running:
bunzip2 filename.bz2

tar and gzip

tar

To store files in an archive, combines many files into 1, not compressed, can do subdirectories.  Do man tar for complete list of options

Syntax:

# tar  [ options ] backup_filename   /directory/file_to_backup

Example:

# tar -cvf  /backup  /etc/*

Options:  (partial)

-c create
-v verify
-f file
-x extract
-z reads files through gzip
-h follow symbolic links when archiving instead of just link names
--help shows help
-r append to the end of the file
-d compare archive with actual files
-t lists members of archive
-Z decompress at same time when reading or writing
-w interactive, asks before destructive operations
-k keeps old files when extracting
-O extracts to standard output
-version displays version number, copyright message, and some credits

 


gzip

Compresses and decompresses files, usually used with tar to compress a large number of files together

Syntax:

# gzip [ options ] filename

Examples:

# gzip  -d  samba-2.0.7.tar.gz (decompresses samba-2.0.7.tar)

# gzip  /usr/novbackups (compresses the file called novbackups in the /usr directory)

Options:

-d decompress
-c sends to standard output
-h displays help
-l  displays compressed and uncompressed file sizes
-r directory_name recursively searches for specified directory and compressed all the files in them

You can use the tar and gzip command together to expedite the uncompressing and untaring of files with the tar.gz extension, an example would be untaring and decompressing the kernel with one command.. 

# gzip -cd  linux-2.4.0-test9.tar.gz  |  tar  xvf -