• aard
    link
    fedilink
    192 years ago

    You also don’t need the dash for the short options.

    Also, if you’re compressing with bzip2 and have archives bigger than a few megabytes I’ll like you a lot more if you do it with --use-compress-prog=pbzip2

    • @[email protected]OP
      link
      fedilink
      30
      edit-2
      2 years ago

      You also don’t need the dash for the short options.

      True, but I refuse to entertain such a non-standard option format. It’s already enough to tolerate find’s.

      • aard
        link
        fedilink
        182 years ago

        Technically the notation with dashes is the non-standard one - the dash form is a GNU addition. A traditional tar on something like Solaris or HP-UX will throw an error if you try the dash notation.

          • aard
            link
            fedilink
            102 years ago

            Don’t try to take my raw ground pork away from me.

            • Lvxferre
              link
              fedilink
              32 years ago

              my raw ground pork away from me.

              Who are you, the Mett demon?
              Matt Damon made out of mett\

              (It works great with beef, too. Bonus points for the raw yolk over it. If not homemade though there’s literally one bar that I trust with this, salmonella is not fun.)

              • aard
                link
                fedilink
                22 years ago

                Not enough onions. Your average mettigel has better mett/onion ratio.

            • Leo
              link
              fedilink
              English
              22 years ago

              That’s an audible “yuck” from me, man. Well done!

        • TheSaneWriter
          link
          fedilink
          English
          12 years ago

          I like the dashes, they make the options look like options to me.

    • @[email protected]
      link
      fedilink
      112 years ago

      You also don’t need the dash for the short options.

      You know when you meet someone and you’re just like “oh boy, yeah, they’re evil. No humanity at all”

    • Programmer Belch
      link
      fedilink
      English
      22 years ago

      I think the -j also compresses with bzip2 but I’m not sure if this is defined behavior or just a shortcut

      • aard
        link
        fedilink
        32 years ago

        Yes, but I’m asking you to use pbzip. bzip at best utilizes one core, both for packing and unpacking. pbzip uses as many cores as IO bandwith allows - with standard SATA SSDs that’s typically around 30.

        pbzip can only utilize multiple cores if the archive was created with it as well.

          • Programmer Belch
            link
            fedilink
            English
            32 years ago

            I’ve searched for it and xz also doesn’t use multithreading by default, you can change the program tar uses to compress by passing the -I option. For xz using all possible CPU threads:

            tar -cv -I 'xz -6 -T0' -f archive.tar.xz [list of directories]

            The number indicates the compression ratio, the higher the number, the more compressed the archive will be but it will cost more in terms of memory and processing time

            • TheSaneWriter
              link
              fedilink
              English
              22 years ago

              Thanks for answering your own question, this is useful information.

      • @[email protected]
        link
        fedilink
        English
        32 years ago

        There’s nothing technically wrong with using xjf rather than xzf, but it’ll bite you if you ever use a non-linux platform as it’s a GNU extension. I’m not even sure busybox tar supports it.

  • @[email protected]
    link
    fedilink
    22 years ago

    Damn, I’m using the “tape archiver” (this is what tar means) since I installed HPUX8 in the 90s, from tape, yes…

  • Maoo [none/use name]
    link
    fedilink
    English
    452 years ago

    No no it’s this:

    1. Decide you’ve gotta use tar.

    2. man tar

    3. Guess-and-check the flags until it seems to work.

    4. Immediately forget the flags.

    • bahmanm
      link
      fedilink
      English
      102 years ago

      That was my case until I discovered that GNU tar has got a pretty decent online manual - it’s way better written than the manpage. I rarely forget the options nowadays even though I dont’ use tar that frequently.

    • CarbonScored [any]
      link
      fedilink
      English
      2
      edit-2
      2 years ago

      As much as I also do step 4, to be honest I don’t see people use man anywhere near as much as they should. Whenever faced with the question “what are the arguments for doing xyz”, I immediately man it and just tell them - Practically everywhere you can execute a given command, you can also read full and comprehensive documentation, just look!

  • @[email protected]
    link
    fedilink
    English
    22 years ago

    So a serious question from someone who can’t remember console commands ever despite using them constantly.

    Why are so many linux CLI commands set up with defaults that no one ever uses? Like if you pretty much always need -f, -v is often used, and --auto-compress is needed to recognize type by extension. Why aren’t those the defaults to just using tar?

    A lot of applications I find are like this too, they don’t come with defaults that work or that anyone would ever use.

    • @[email protected]
      link
      fedilink
      72 years ago

      One reason to keep in mind is backwards compatibility and the expectancy that every Linux system has the same basic tools that work the same.

      Imagine you have a script running on your server that uses a command with or without specific arguments. If the command (say tar) changes its default parameters this could lead to a lot of nasty side effects from crashes to lost or mangled data. Besides the headache of debugging that, even if you knew about the change beforehand it’s still a lot effort to track down every piece of code that makes use of that command and rewrite it.

      That’s why programs and interfaces usually add new options over time but are mostly hesitant to remove old ones. And if they do they’ll usually warn the others beforehand that a feature will deprecate while allowing for a transitional period.

      One way to solve this conundrum is to simply introduce new commands that offer new features and a more streamlined approach that can replace the older ones in time. Yet a distribution can still ship the older ones alongside the newer ones just in case they are needed.

      Looking at pagers (programs that break up long streams of text into multiple pages that you can read one at a time) as a simple example you’ll find that more is an older pager program while the newer less offers an even better experience (“less is more”, ¿get the joke?). Both come pre-installed as core tools on many distributions. Finally an even more modern alternative is most, another pager with even better functionality, but you’ll need to install that one yourself.

  • @[email protected]
    link
    fedilink
    32 years ago

    I just use atool (archive tool) instead. It works the same for any common compression format (tar, gzip, zip, 7zip, rar, etc) and comes with handy aliases like apack and aunpack obsoleting the need to memorize options.

      • The Ramen Dutchman
        link
        fedilink
        22 years ago

        I like this summary much more, it’s a great visual explanation and doesn’t clutter the poor dummy’s mind with ALL the infotar has to offer.

  • cally [he/they]
    link
    fedilink
    English
    32 years ago

    I would also recommend -v for verbose and -z when compressing for gzip

    What does --auto-compress do?

    • Drew
      link
      fedilink
      22 years ago

      Auto compress will use gzip if the file ends with .gz, bzip if it ends with .bz, and so on without mentioning -z

  • @[email protected]
    link
    fedilink
    22 years ago

    OMG always assumed that -c always stands for “compress” and I always placed .gz at the end to remember to place -x when extracting

    • @[email protected]
      link
      fedilink
      32 years ago

      tar was originally was for tape archiving so it’s just a stream of headers and files which end up directed to a file or a device. It’s not well ordered, just whatever file happens to be found next is the next in the stream. When you compress the tar this stream it’s just piped through gzip or bzip2 on its way.

      The tradeoff for compressing this way is if you want to list the contents of the tar then you essentially have to decompress and stream through the whole thing to see what’s in it unlike a .zip or .7z where there would be a separate index at the end which can be read far more easily.

  • @[email protected]
    link
    fedilink
    52 years ago

    I just have pack and extract functions in my shell RC files that look at file extensions and use the proper tool with proper arguments.

    Wrote them 10 years ago and they’ve worked flawlessly ever since!

    • @[email protected]
      link
      fedilink
      22 years ago

      Brilliant! As an apple engineer, I think I will do the same thing with image previews in iMessage! What can go wrong?

      • Bloody Harry
        link
        fedilink
        12 years ago

        Who could have guessed that an ancient and forgotten image format suddenly gets that big of a revival.