{"id":25707,"date":"2024-07-18T04:45:39","date_gmt":"2024-07-17T21:45:39","guid":{"rendered":"https:\/\/dte.telkomuniversity.ac.id\/?p=25707"},"modified":"2024-07-18T04:45:41","modified_gmt":"2024-07-17T21:45:41","slug":"perintah-gzip-di-linux","status":"publish","type":"post","link":"https:\/\/dte.telkomuniversity.ac.id\/en\/perintah-gzip-di-linux\/","title":{"rendered":"Perintah gzip di Linux"},"content":{"rendered":"\n<p>Gzip (GNU zip) adalah alat kompresi yang digunakan untuk memperkecil ukuran file. Secara default, file asli akan digantikan oleh file terkompresi yang berakhiran ekstensi (.gz).<\/p>\n\n\n\n<p>Untuk mendekompresi file, Anda dapat menggunakan perintah <code>gunzip<\/code>, dan file asli Anda akan kembali.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">Sintaks:<\/h3>\n\n\n\n<pre class=\"wp-block-preformatted\">phpSalin kode<code>gzip &lt;file1&gt; &lt;file2&gt; &lt;file3&gt;...\ngunzip &lt;file1&gt; &lt;file2&gt; &lt;file3&gt;...\n<\/code><\/pre>\n\n\n\n<h3 class=\"wp-block-heading\">Contoh:<\/h3>\n\n\n\n<pre class=\"wp-block-preformatted\">Salin kode<code>gzip file1.txt file2.txt\ngunzip file1.txt.gz file2.txt.gz\n<\/code><\/pre>\n\n\n\n<p>Perhatikan snapshot di atas, perintah gzip telah mengompres file &#8216;file1.txt&#8217; dan &#8216;file2.txt&#8217;. File terkompresi ditampilkan dengan ekstensi (.gz). Sementara itu, perintah gunzip telah mendekompresi file yang sama dan ekstensi (.gz) dihapus.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Opsi gzip<\/h2>\n\n\n\n<h3 class=\"wp-block-heading\">Mengompres Banyak File Bersama<\/h3>\n\n\n\n<p>Jika Anda ingin mengompres lebih dari satu file secara bersamaan, Anda dapat menggunakan perintah &#8216;cat&#8217; dan gzip dengan perintah pipe.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">Sintaks:<\/h3>\n\n\n\n<pre class=\"wp-block-preformatted\">phpSalin kode<code>cat &lt;file1&gt; &lt;file2&gt;... | gzip &gt; &lt;newFile.gz&gt;\n<\/code><\/pre>\n\n\n\n<h3 class=\"wp-block-heading\">Contoh:<\/h3>\n\n\n\n<pre class=\"wp-block-preformatted\">arduinoSalin kode<code>cat file1.txt file2.txt | gzip &gt; final.gz\n<\/code><\/pre>\n\n\n\n<p>Perhatikan snapshot di atas, kedua file &#8216;file1.txt&#8217; dan &#8216;file2.txt&#8217; dikompres menjadi &#8216;final.gz&#8217;.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">Perintah gzip -l<\/h3>\n\n\n\n<p>Perintah &#8216;gzip -l&#8217; memberikan informasi tentang rasio kompresi atau seberapa banyak file asli telah terkompresi.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">Sintaks:<\/h3>\n\n\n\n<pre class=\"wp-block-preformatted\">phpSalin kode<code>gzip -l &lt;file1&gt; &lt;file2&gt;...\n<\/code><\/pre>\n\n\n\n<h3 class=\"wp-block-heading\">Contoh:<\/h3>\n\n\n\n<pre class=\"wp-block-preformatted\">arduinoSalin kode<code>gzip -l final.gz jtp.txt.gz\n<\/code><\/pre>\n\n\n\n<p>Perhatikan snapshot di atas, perintah &#8220;gzip -l final.gz jtp.txt.gz&#8221; menunjukkan rasio kedua file tersebut.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Cara Mengompres Direktori<\/h2>\n\n\n\n<p>Perintah gzip tidak dapat mengompres direktori karena hanya bisa mengompres satu file. Untuk mengompres direktori, Anda harus menggunakan perintah &#8216;tar&#8217;.<\/p>\n\n\n\n<p>Tanda hubung (-) tidak wajib dalam perintah &#8216;tar&#8217;.<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>&#8216;c&#8217; untuk membuat,<\/li>\n\n\n\n<li>&#8216;v&#8217; untuk verbose, menampilkan output,<\/li>\n\n\n\n<li>&#8216;f&#8217; untuk menyebutkan tujuan file output Anda,<\/li>\n\n\n\n<li>&#8216;z&#8217; untuk spesifikasi kompresi dengan gzip.<\/li>\n<\/ul>\n\n\n\n<h3 class=\"wp-block-heading\">Sintaks:<\/h3>\n\n\n\n<pre class=\"wp-block-preformatted\">phpSalin kode<code>tar cf - &lt;direktori&gt; | gzip &gt; &lt;namaDirektori&gt;\n<\/code><\/pre>\n\n\n\n<p>ATAU<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">Salin kode<code>tar cvfz office.tar.gz office\n<\/code><\/pre>\n\n\n\n<h3 class=\"wp-block-heading\">Contoh:<\/h3>\n\n\n\n<pre class=\"wp-block-preformatted\">Salin kode<code>tar cf - office | gzip &gt; office.tar.gz\n<\/code><\/pre>\n\n\n\n<p>Perhatikan snapshot di atas, direktori &#8216;office&#8217; telah dikompres dengan perintah &#8216;tar&#8217;.<\/p>\n\n\n\n<p>3.5<\/p>\n\n\n\n<p><\/p>\n\n\n\n<p>ref:<a href=\"https:\/\/www.javatpoint.com\/linux-gzip\" data-type=\"link\" data-id=\"https:\/\/www.javatpoint.com\/linux-gzip\">[1]<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Gzip (GNU zip) adalah alat kompresi yang digunakan untuk memperkecil ukuran file. Secara default, file asli akan digantikan oleh file terkompresi yang berakhiran ekstensi (.gz). Untuk mendekompresi file, Anda dapat menggunakan perintah gunzip, dan file asli Anda akan kembali. Sintaks: phpSalin kodegzip &lt;file1&gt; &lt;file2&gt; &lt;file3&gt;&#8230; gunzip &lt;file1&gt; &lt;file2&gt; &lt;file3&gt;&#8230; Contoh: Salin kodegzip file1.txt file2.txt gunzip [&hellip;]<\/p>\n","protected":false},"author":25,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"wds_primary_category":0,"footnotes":""},"categories":[101],"tags":[],"class_list":["post-25707","post","type-post","status-publish","format-standard","hentry","category-berita"],"_links":{"self":[{"href":"https:\/\/dte.telkomuniversity.ac.id\/en\/wp-json\/wp\/v2\/posts\/25707","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/dte.telkomuniversity.ac.id\/en\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/dte.telkomuniversity.ac.id\/en\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/dte.telkomuniversity.ac.id\/en\/wp-json\/wp\/v2\/users\/25"}],"replies":[{"embeddable":true,"href":"https:\/\/dte.telkomuniversity.ac.id\/en\/wp-json\/wp\/v2\/comments?post=25707"}],"version-history":[{"count":2,"href":"https:\/\/dte.telkomuniversity.ac.id\/en\/wp-json\/wp\/v2\/posts\/25707\/revisions"}],"predecessor-version":[{"id":25709,"href":"https:\/\/dte.telkomuniversity.ac.id\/en\/wp-json\/wp\/v2\/posts\/25707\/revisions\/25709"}],"wp:attachment":[{"href":"https:\/\/dte.telkomuniversity.ac.id\/en\/wp-json\/wp\/v2\/media?parent=25707"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/dte.telkomuniversity.ac.id\/en\/wp-json\/wp\/v2\/categories?post=25707"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/dte.telkomuniversity.ac.id\/en\/wp-json\/wp\/v2\/tags?post=25707"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}