{
  "version": "https://jsonfeed.org/version/1",
  "title": "Ian's Digital Garden",
  "home_page_url": "https://ianwwagner.com/",
  "feed_url": "https://ianwwagner.com//tag-compression.json",
  "description": "",
  "items": [
    {
      "id": "https://ianwwagner.com//using-tar-with-your-favorite-compression.html",
      "url": "https://ianwwagner.com//using-tar-with-your-favorite-compression.html",
      "title": "Using tar with Your Favorite Compression",
      "content_html": "<p>Here's a fun one!\nYou may already know that tarball is a pure archive format,\nand that any compression is applied to the whole archive as a unit.\nThat is to say that compression is not actually applied at the <em>file</em> level,\nbut to the entire archive.</p>\n<p>This is a trade-off the designers made to limit complexity,\nand as a side-effect, is the reason why you can't randomly access parts of a compressed tarball.</p>\n<p>What you may not know is that the <code>tar</code> utility has built-in support for a few formats!\nGZIP is probably the most commonly used for historical reasons,\nbut <code>zstd</code> and <code>lz4</code> are built-in options on my Mac.\nThis is probably system-dependent, so check your local manpages.</p>\n<p>Here's an example of compressing and decompressing with <code>zstd</code>:</p>\n<pre><code class=\"language-shell\">tar --zstd -cf directory.tar.zst directory/\ntar --zstd -xf directory.tar.zst\n</code></pre>\n<p>You can also use this with <em>any</em> (de)compression program that operates on stdin and stdout!</p>\n<pre><code class=\"language-shell\">tar --use-compress-program zstd -cf directory.tar.zst directory/\n</code></pre>\n<p>Pretty cool, huh?\nIt's no different that using pipes at the end of the day,\nbut it does simplify the invocation a bit in my opinion.</p>\n<p>After I initially published this article,\n<code>@cartocalypse@norden.social</code> noted that some versions of tar include the\n<code>-a</code>/<code>--auto-compress</code> option which will automatically determine format and compression based on the suffix!\nCheck your manpages for details; it appears to work on FreeBSD, macOS (which inherits the FreeBSD implementation), and GNU tar.</p>\n",
      "summary": "",
      "date_published": "2025-12-14T00:00:00-00:00",
      "image": "",
      "authors": [
        {
          "name": "Ian Wagner",
          "url": "https://fosstodon.org/@ianthetechie",
          "avatar": "media/avi.jpeg"
        }
      ],
      "tags": [
        "shell",
        "compression",
        "tar"
      ],
      "language": "en"
    }
  ]
}