• Zacryon@feddit.de
    link
    fedilink
    arrow-up
    8
    ·
    1 year ago

    Ah yes, that’s the linux community as I know it. There is one thing someone wants to achieve and dozens of ways to do it. ;)

  • Admin@r.nf
    link
    fedilink
    English
    arrow-up
    4
    ·
    edit-2
    1 year ago

    My tar command is tldr tar then ctrl + c / ctrl + v

  • blackstrat@lemmy.fwgx.uk
    link
    fedilink
    English
    arrow-up
    4
    ·
    1 year ago

    I hope whoever thought -l should mean “check links” instead of list has a special place in Hell set aside for them.

    I have no idea what print a message if not all links are dumped even means.

  • miniu@programming.dev
    link
    fedilink
    arrow-up
    3
    ·
    1 year ago

    Why when explaining, giving examples of shell command are people so often providing shortened arguments. It makes it all seam like some random letters you have to remeber by heart. Instead of -x just write --extract. If in the end they endup using the tool so often they need to write it fast they’ll check the shortcuts.

    • catacomb@beehaw.org
      link
      fedilink
      English
      arrow-up
      1
      ·
      edit-2
      1 year ago

      I don’t even mind the shortened arguments too much, though it doesn’t help. It’s more that every example seems to smush them together into a string of letters.

      I would have found

      tar -x -f pics.tar ./pics

      to be clearer when I was learning. There’s plenty of commands which allow combining flags but every tar tutorial seems to do it from the beginning.

      • Zangoose@lemmy.one
        link
        fedilink
        arrow-up
        2
        ·
        1 year ago

        Most commands will have expanded arguments started with 2 dashes that usually look like ‘–verbose-name-of-option’, they’re usually listed in the man page/documentation along with the abbreviated letter version

      • sonnenzeit@feddit.de
        link
        fedilink
        arrow-up
        2
        ·
        edit-2
        1 year ago

        Many do as it’s considered good practice, but it’s not guaranteed, it just depends on the individual command (program). Usually you can use the --help option to see all the options, so for instance tar --help.

        • barsoap@lemm.ee
          link
          fedilink
          arrow-up
          2
          ·
          1 year ago

          tar -xf is not really special combining short options isn’t uncommon.

          Where tar is nonstandard is that you can leave out the -, tar xf is actually how POSIX specifies it. And we’ve kinda come full circle on that one with many modern utilities using a command syntax, you can read tar xf as “tar extract file” just as you can read git pull as, well, “git pull”.

          If you want to see a standard command with truly non-standard syntax have a look at dd.

    • Drew@sopuli.xyz
      link
      fedilink
      arrow-up
      2
      ·
      1 year ago

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

  • MangoPenguin@lemmy.blahaj.zone
    link
    fedilink
    English
    arrow-up
    2
    ·
    1 year 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.

    • sonnenzeit@feddit.de
      link
      fedilink
      arrow-up
      7
      ·
      1 year 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.

  • Magister@lemmy.world
    link
    fedilink
    arrow-up
    2
    ·
    1 year ago

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

  • Blackmist@feddit.uk
    link
    fedilink
    English
    arrow-up
    2
    ·
    1 year ago

    Yes, that’s all very well, but you’ll still need to find that image the next time you want to use it.

  • exu@feditown.com
    link
    fedilink
    English
    arrow-up
    2
    ·
    1 year ago

    That looks really cool. And finally a guide that knows -z is not necessary all the time.

  • arc@lemm.ee
    link
    fedilink
    arrow-up
    1
    ·
    edit-2
    1 year ago

    I know the basics off by heart. Not the hardest command syntax to learn all things considered.

    The most annoying would be the growing collection of “uber commands” which are much more of a pain in the ass - aws, systemctl, docker, kubectl, npm, cargo, etc. - the executable has potentially dozens of subcommands, each of which has dozens of parameters.

    • stilgar [he/him] @infosec.pub
      link
      fedilink
      English
      arrow-up
      1
      ·
      1 year ago

      These “uber commands” tend to be much better since they are more explorable with --help explanations and readable flags.

      Much better than the random jumble of characters you’re expected to have memorised for awk, sed, find et al.