Pages by Andreas B. M. Hofmeier
An-H
email Impressum/Note Privacy
http[s]://www.abmh.de/en/papers/ls/Tar_untar_gzip_and_finding_out_a_file_type.html

Like to be free? ... then: Fight for Freedom

Tar, untar, gzip and finding out a file type

From Linux Solutions

Jump to: navigation, search

Zipping Files with tar

putting all under directory into the /tmp/archive.tar-file. It will not be compressed therefore it is faster than with compression:

tar cvf /tmp/archive.tar directory

compressing all under directory into the /tmp/archive.tar.gz-file. It will be compressed but takes longer:

tar cvzf /tmp/archive.tar.gz directory

(directory could by a list of files and directory which you want to be tared)


Unpacking or unzipping a file:

unpacking /tmp/archive.tar into the actual directory:

tar xvf /tmp/archive.tar


unzipping /tmp/archive.tar.gz into the actual directory:

tar xvzf /tmp/archive.tar.gz

unzipping /tmp/archive.tar.bz2 into the actual directory:

tar xvjf /tmp/archive.tar.bz2

The option "v" tells tar that it should print the names of all files which are compressed or decompressed. If your Internet connection is slow, it will slow the progress significantly down. So may you leave out "v".


If you have an file and you are not sure, what type it is, try this:

file filename

e.g.

file /tmp/archive.tar.bz2

gives you

/tmp/archive.tar.bz2: bzip2 compressed data, block size = 900k

you can decompress it with

bunzip2 /tmp/archive.tar.bz2

you get /tmp/archive.tar

file /tmp/archive.tar

gives you

/tmp/archive.tar: POSIX tar archive

and you can extract it with

tar xvf /tmp/archive.tar


Andreas B.M. Hofmeier.


Pages by Andreas B. M. Hofmeier
An-H
email Impressum/Note Privacy
http[s]://www.abmh.de/en/papers/ls/Tar_untar_gzip_and_finding_out_a_file_type.html
Creative Commons License
(c) Andreas B. M. Hofmeier
This work is licensed under a Creative Commons Attribution-Noncommercial-Share Alike 3.0 Germany License