{"id":6692,"date":"2022-06-30T00:05:36","date_gmt":"2022-06-30T00:05:36","guid":{"rendered":"https:\/\/swiv.com.br\/linux-gzip-command\/"},"modified":"2026-05-27T20:02:29","modified_gmt":"2026-05-27T19:02:29","slug":"linux-gzip-command","status":"publish","type":"post","link":"https:\/\/swiv.com.br\/index.php\/2022\/06\/30\/linux-gzip-command\/","title":{"rendered":"Linux &#8220;GZIP&#8221; command"},"content":{"rendered":"\n<p>Este recurso nos permite compactar aquivos usando o Lempel-Ziv coding (LZ77). Neste artigo vamos ver alguns exemplos de utiliza\u00e7\u00e3o.<\/p>\n\n\n\n<p>Compactando um arquivo existente usando o comando gzip. Percebemos que o arquivo original deixa de existir, dando vez ao novo arquivo compactado:<\/p>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \\&quot;wp-block-syntaxhighlighter-code\\&quot;\"><pre class=\"brush: plain; title: ; notranslate\" title=\"\">\n&#x5B;oracle@oel7 ~]$ ll ARQUIVOS.tar\n-rw-r--r--. 1 oracle oinstall 10240 Jun 29 20:37 ARQUIVOS.tar\n&#x5B;oracle@oel7 ~]$ gzip ARQUIVOS.tar\n&#x5B;oracle@oel7 ~]$ ll ARQUIVOS*\n-rw-r--r--. 1 oracle oinstall 335 Jun 29 20:37 ARQUIVOS.tar.gz\n&#x5B;oracle@oel7 ~]$\n<\/pre><\/div>\n\n\n<p>Para descompactar, podemos usar os comandos abaixo. Percebemos que o arquivo antes compactado deixa de existir e d\u00e1 vez ao conte\u00fado descompactado:<\/p>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \\&quot;wp-block-syntaxhighlighter-code\\&quot;\"><pre class=\"brush: plain; title: ; notranslate\" title=\"\">\n&#x5B;oracle@oel7 ~]$ gunzip ARQUIVOS.tar.gz\n&#x5B;oracle@oel7 ~]$ ll ARQUIVOS*\n-rw-r--r--. 1 oracle oinstall 10240 Jun 29 20:37 ARQUIVOS.tar\n<\/pre><\/div>\n\n<div class=\"wp-block-syntaxhighlighter-code \\&quot;wp-block-syntaxhighlighter-code\\&quot;\"><pre class=\"brush: plain; title: ; notranslate\" title=\"\">\n&#x5B;oracle@oel7 ~]$ gzip -d ARQUIVOS.tar.gz\n&#x5B;oracle@oel7 ~]$ ll ARQUIVOS*\n-rw-r--r--. 1 oracle oinstall 10240 Jun 29 20:37 ARQUIVOS.tar\n<\/pre><\/div>\n\n\n<p>No dia a dia, \u00e9 comum usarmos o GZIP ao mesmo tempo que o comando TAR. Basta adicionar o par\u00e2metro &#8220;z&#8221; para a compacta\u00e7\u00e3o, conforme exemplo abaixo:<\/p>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \\&quot;wp-block-syntaxhighlighter-code\\&quot;\"><pre class=\"brush: plain; title: ; notranslate\" title=\"\">\n&#x5B;oracle@oel7 ~]$ tar zcpfv ARQUIVOS.tgz log.sql SS.txt\nlog.sql\nSS.txt\n&#x5B;oracle@oel7 ~]$ ll ARQUIVOS.tgz\n-rw-r--r--. 1 oracle oinstall 322 Jun 29 20:59 ARQUIVOS.tgz\n<\/pre><\/div>\n\n\n<p>Para descompactar, a din\u00e2mica \u00e9 a mesma:<\/p>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \\&quot;wp-block-syntaxhighlighter-code\\&quot;\"><pre class=\"brush: plain; title: ; notranslate\" title=\"\">\n&#x5B;oracle@oel7 ~]$ tar zxvf ARQUIVOS.tgz\nlog.sql\nSS.txt\n<\/pre><\/div>","protected":false},"excerpt":{"rendered":"<p>Este recurso nos permite compactar aquivos usando o Lempel-Ziv coding (LZ77). Neste artigo vamos ver alguns exemplos de utiliza\u00e7\u00e3o. Compactando um arquivo existente usando o comando gzip. Percebemos que o arquivo original deixa de existir, dando vez ao novo arquivo compactado: Para descompactar, podemos usar os comandos abaixo. Percebemos que o arquivo antes compactado deixa [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[6],"tags":[],"class_list":["post-6692","post","type-post","status-publish","format-standard","hentry","category-linux"],"_links":{"self":[{"href":"https:\/\/swiv.com.br\/index.php\/wp-json\/wp\/v2\/posts\/6692","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/swiv.com.br\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/swiv.com.br\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/swiv.com.br\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/swiv.com.br\/index.php\/wp-json\/wp\/v2\/comments?post=6692"}],"version-history":[{"count":1,"href":"https:\/\/swiv.com.br\/index.php\/wp-json\/wp\/v2\/posts\/6692\/revisions"}],"predecessor-version":[{"id":9039,"href":"https:\/\/swiv.com.br\/index.php\/wp-json\/wp\/v2\/posts\/6692\/revisions\/9039"}],"wp:attachment":[{"href":"https:\/\/swiv.com.br\/index.php\/wp-json\/wp\/v2\/media?parent=6692"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/swiv.com.br\/index.php\/wp-json\/wp\/v2\/categories?post=6692"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/swiv.com.br\/index.php\/wp-json\/wp\/v2\/tags?post=6692"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}