UNIX / Linux Decompress tgz / tar.gz Files

来源:互联网 发布:js工厂方法 编辑:程序博客网 时间:2024/05/01 17:33

Q. I've downloaded a file from internet in .tgz format. How do I decompress .tgz file under UNIX or Linux operating system using a shell prompt?

A. This is archive file also known as tar ball. If an archive is compressed with an external tool, the compression program adds its own suffix as usual, resulting in filename endings like ".tar.Z", ".tar.gz", and ".tar.bz2" or tgz. To open such file type the following command at Linux shell prompt (GNU tar syntax):
$ tar -zxvf filename.tgz
$ tar -zxvf filename.tar.gz
$ tar -jxvf filename.tar.bz2

UNIX decompress tgz / tar.gz file

Type the following command:
$ gzip -dc filename.tgz | tar xf -
$ gzip -dc filename.tar.gz | tar xf -

If file extension ends with .Z, enter:
$ zcat filename.tar.Z | tar xf -


转自:http://www.cyberciti.biz/faq/decompress-tgz-targz-files/

原创粉丝点击