Tradional Usage
  tar {A|c|d|r|t|u|x}[GnSkUWOmpsMBiajJzZhPlRvwo] [ARG...]

It is invigorating.

  • Muehe@lemmy.ml
    link
    fedilink
    arrow-up
    0
    ·
    10 hours ago

    What nobody posted the tar XKCD yet?

    Title text:

    I don’t know what’s worse–the fact that after 15 years of using tar I still can’t keep the flags straight, or that after 15 years of technological advancement I’m still mucking with tar flags that were 15 years old when I started.

    By the way, tar -h is not a valid command, the flag is related to symlinks. You will want to use -? or --help.

    • sanzky@lemmy.world
      link
      fedilink
      arrow-up
      0
      ·
      9 hours ago

      I was going to reply with a joke about ffmpeg but it seems the full thread is mostly that.

      • TheSyndZ@lemmy.dbzer0.com
        link
        fedilink
        English
        arrow-up
        0
        ·
        2 days ago

        Well i’ll be damned learning just now thanks to you that it equals -rlptgoD (recursive, links, perms, times, group, owner, devices)

        I’m one of the lucky 10000…

        • stembolts@programming.dev
          link
          fedilink
          arrow-up
          0
          ·
          9 hours ago

          You have revealed yourself.
          You didn’t read the man page.
          It’s on the -a documentation!!

          Heretic! Jk.

          I only know this because a few years ago I was scripting with rsync and the first thing I did was read thru to see which flags I needed for my usage.

  • Imhotep@lemmy.world
    link
    fedilink
    arrow-up
    0
    ·
    2 days ago

    If like me you have no memory, use aliases often.

    Put them in a dedicated file, I find it easier to manage. You’ll need to modify bashrc or zshrc to link to the new file. Big plus, they now work with both. I don’t know if it can be done with fish.

    Now my favorite tip for us brainless: start aliases with an easy to reach character you most likely wouldn’t use in a terminal. I use “é”, on a french keyboard.

    é+tab: all my aliases é+t+tab: I see “étarextract” (there it is), “étext-edit”, “étodo”

    I don’t even need to remember aliases. I don’t need to remember anything!
    Imathop out.

  • groucho@retrolemmy.com
    link
    fedilink
    English
    arrow-up
    0
    ·
    2 days ago

    Honestly I just create and extract. I don’t use most of the options. But, I had a lead about ten years ago dare me to create and compress a .tar.gz directly without looking it up and I was most of the way through typing it by the time he finished talking. He looked at me like I was doing black magic.

  • esc@piefed.social
    link
    fedilink
    English
    arrow-up
    0
    ·
    2 days ago

    It’s pretty simple

    tar
     e[x]tract
     [z]is
     [f]ile
     [v]erbosely
    archive.tar.gz
    --directory=archivedir
    

    For creation it’s pretty much the same but you need to specify [c]reate, e.g. tar czvf archive.tar.gz filestoarchive/ and for lis[t]ing it’s - tar tf archive.tar.gz

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

    Tar (some versions at least?) is actually smart enough to detect which format to use based on file extension of the output, so you don’t need to remember which flag corresponds to which compressor. Examples:

    tar -caf archive.tar.xz [files]
    tar -caf archive.tar.bz2 [files]
    
    # extract
    tar -xf archive.tar.xz
    tar -xf archive.tar.bz2
    

    So you really only need to remember that c means create, x means extract

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

      You don’t need more, you can just grep tar ~/.zsh_history

      If you only want the first ten results pipe to head.

      If you want more interactivity use less ~/.zsh_history Then press / to search. Press n for next match