Opening a .tar.gz file with a single command

前端 未结 7 1336
时光取名叫无心
时光取名叫无心 2021-01-31 15:13

When I download a .tar.gz file, I open it with two commands, first gunzip and then tar.

Is it possible to open it with just one command?

7条回答
  •  难免孤独
    2021-01-31 15:49

    How do I extract a gz file?

    Use guzip command as follows:

    $ gunzip file.gz
    

    OR

    $ gzip -d file.gz
    

    How do I extract a tar.gz or .tgz file?

    Files with extension tar.gz or .tgz are tar files compressed with gzip. On Unix system extract them with following command:

    $ gunzip < file.tar.gz | tar xvf -
    $ gunzip < file.tgz | tar xvf -
    

    If you have GNU tar (Linux system) you can use the z option directly:

    $ tar xvzf file.tar.gz
    $ tar xvzf file.tgz
    

    To read more go to http://www.cyberciti.biz/faq/howto-compress-expand-gz-files/

提交回复
热议问题