• merc@sh.itjust.works
      link
      fedilink
      arrow-up
      0
      ·
      2 days ago

      One reason is that tar supports both traditional style args “tar tf <filename.tar>” and unix-style args “tar -tf <filename.tar>” but there are subtle differences in how they work.

      • Ethan@programming.dev
        link
        fedilink
        English
        arrow-up
        0
        ·
        2 days ago

        Literally the only time I’ve ever run into that is when I was trying to manipulate the path it extracted to. In 99% of cases I’m doing tf, xf, or cf plus flags for the compression type, etc, and those differences are irrelevant.

        • merc@sh.itjust.works
          link
          fedilink
          arrow-up
          0
          ·
          2 days ago

          I used something recently where it wasn’t possible to use the traditional-style args. I think it was a “diff”, which meant I needed a “-f”. It wasn’t a big deal, but, occasionally it does happen.

          • Ethan@programming.dev
            link
            fedilink
            English
            arrow-up
            0
            ·
            14 hours ago

            I’m not saying it doesn’t happen. This thread started because I said I’ve never understood why people talk like tar is some indecipherable black magic. Common tasks are easy and there’s a man page for everything else.

    • Eager Eagle@lemmy.world
      link
      fedilink
      English
      arrow-up
      0
      ·
      edit-2
      3 days ago

      I got tired of looking up the options for each possible combination of archiving + compression, so today I have a “magic” bash function that can extract almost any format.

      Then for compressing, I only use zip, which doesn’t need any args other than the archive name and the thing you’re compressing. It needs -r when recursing on dirs, but unlike “eXtract” and “Ze”, that’s a good mnemonic.

      • Ethan@programming.dev
        link
        fedilink
        English
        arrow-up
        0
        ·
        edit-2
        3 days ago

        I almost never create a tarball, so I have to look up the syntax for that. Which is as simple as man tar. But as far as extracting it almost couldn’t be easier, tar xf <tarball> and call it a day. Or if you want to list the contents without extracting, tar tf <tarball>. Unless you’re using an ancient version of tar, it will detect and handle whatever compression format you’re using without you having to remember if you need z or J or whatever.