how to extract archive in linux

by gowtham 2010-02-03 12:53:48

Extracting archives is also very simple. Instead of the c switch the x is used and the archive name is given as the only other parameter. The commands for archive extraction shown below correspond to the archive creation commands given earlier.

tar xf dir.tar # ©2007 linux.dsplabs.com.au
tar xzf dir.tar.gz # ©2007 linux.dsplabs.com.au
tar xjf dir.tar.bz2 # ©2007 linux.dsplabs.com.au

Infact, in most cases, tar will figure out what archive type you are trying to extract (from their hex headers I suppose), so that the filter specifications are not really needed. Hence, the following still works fine.

tar xf dir.tar # ©2007 linux.dsplabs.com.au
tar xf dir.tar.gz # ©2007 linux.dsplabs.com.au
tar xf dir.tar.bz2 # ©2007 linux.dsplabs.com.au

However, if you explicitly specify the decoder, then tar will assume that that is the encoding of the given archive. If for whatever reason that is not the case, an error will occur.

Tagged in:

978
like
0
dislike
0
mail
flag

You must LOGIN to add comments