this post was submitted on 15 May 2024
24 points (96.2% liked)

linuxmemes

21291 readers
1224 users here now

Hint: :q!


Sister communities:


Community rules (click to expand)

1. Follow the site-wide rules

2. Be civil
  • Understand the difference between a joke and an insult.
  • Do not harrass or attack members of the community for any reason.
  • Leave remarks of "peasantry" to the PCMR community. If you dislike an OS/service/application, attack the thing you dislike, not the individuals who use it. Some people may not have a choice.
  • Bigotry will not be tolerated.
  • These rules are somewhat loosened when the subject is a public figure. Still, do not attack their person or incite harrassment.
  • 3. Post Linux-related content
  • Including Unix and BSD.
  • Non-Linux content is acceptable as long as it makes a reference to Linux. For example, the poorly made mockery of sudo in Windows.
  • No porn. Even if you watch it on a Linux machine.
  • 4. No recent reposts
  • Everybody uses Arch btw, can't quit Vim, and wants to interject for a moment. You can stop now.
  •  

    Please report posts and comments that break these rules!


    Important: never execute code or follow advice that you don't understand or can't verify, especially here. The word of the day is credibility. This is a meme community -- even the most helpful comments might just be shitposts that can damage your system. Be aware, be smart, don't fork-bomb your computer.

    founded 1 year ago
    MODERATORS
     

    Was trying to extract a totally legit copy of Skate 3 I downloaded today to play on my Steam Deck

    top 47 comments
    sorted by: hot top controversial new old
    [–] [email protected] 7 points 6 months ago
    [–] [email protected] 5 points 6 months ago* (last edited 6 months ago) (2 children)
    [–] [email protected] 3 points 6 months ago (2 children)

    In the true spirit of UNIX, it’s tar -h

    [–] [email protected] 1 points 6 months ago

    It's tar --help on my system 💥

    [–] [email protected] 1 points 6 months ago (1 children)

    You just killed us all by putting a space between the dashes

    [–] [email protected] 2 points 6 months ago

    Fuckin autocorrect was the death of us all.

    [–] [email protected] 4 points 6 months ago
    [–] [email protected] 4 points 6 months ago (2 children)

    tar --version

    You're welcome

    [–] [email protected] 1 points 6 months ago (1 children)

    I'd have gone with tar --help

    [–] [email protected] 3 points 6 months ago* (last edited 6 months ago) (1 children)

    It's insane that this isn't consistent.

    Any combination of -h, -? and --help exists between tools (from 0 to all 3 of them)

    [–] [email protected] 1 points 6 months ago (1 children)

    Never seen -?, it's either -h, --help, or -help for programs that just want to be different.

    [–] [email protected] 0 points 6 months ago (1 children)
    [–] [email protected] 1 points 6 months ago

    It's literally there at the bottom.

    What isn't valid is MacOS, it's macOS now.

    [–] [email protected] 2 points 6 months ago (2 children)

    tar -czvf tar_name.tar.gz ./

    [–] [email protected] 1 points 6 months ago

    I even read this aloud in my head as "CREATE ZE VUCKING FILE" in a particularly bad German accent same as over 20 years ago when a friend I worked for drilled it in my head.

    [–] [email protected] 0 points 6 months ago (1 children)

    File not found, now we are dead.

    [–] [email protected] 1 points 6 months ago

    Sounds like an error message from a valid tar command

    [–] [email protected] 2 points 6 months ago (2 children)
    [–] [email protected] 4 points 6 months ago (1 children)
    [–] [email protected] 2 points 6 months ago

    I like the way you pointed that out lmao

    [–] [email protected] 1 points 6 months ago

    .... aaaaaand you've killed us all.

    [–] [email protected] 2 points 6 months ago (1 children)
    [–] [email protected] 1 points 6 months ago
    tar: You must specify one of the '-Acdtrux', '--delete' or '--test-label' options
    Try 'tar --help' or 'tar --usage' for more information.
    
    [–] [email protected] 2 points 6 months ago* (last edited 6 months ago)

    tar -cvzf /etc/

    Edit: we're dead :(

    [–] [email protected] 2 points 6 months ago

    tar -xzf stands for tar eXtract Ze Filez

    [–] [email protected] 2 points 5 months ago

    I always remember that it's eXtract Ze File, tar -xzf... But I'll be honest, I've not used it in years and years

    [–] [email protected] 1 points 5 months ago

    Now do a standard pax command.

    [–] [email protected] 1 points 6 months ago (1 children)
    [–] [email protected] 1 points 6 months ago
    [–] [email protected] 1 points 6 months ago

    tar --extract --file file.tar.gz

    [–] [email protected] 1 points 5 months ago
    [–] [email protected] 0 points 6 months ago (1 children)

    tar -cf file.tar directory/

    [–] [email protected] 0 points 6 months ago (1 children)

    that was 8 seconds. close one, i saved us all

    [–] [email protected] 0 points 6 months ago (1 children)

    How do you know directory exists? 😨

    [–] [email protected] 1 points 6 months ago
    [–] [email protected] 0 points 6 months ago (1 children)
    [–] [email protected] 0 points 6 months ago (2 children)

    shouldnt there be a filename argument ?

    [–] [email protected] 2 points 5 months ago (1 children)

    I definitely still killed us all, but at the same time how are you supposed to know any of the filenames if none are given from the comic? I guess my real answer is to 'tar -xvf' then hit tab with hopes of decent file completion functionality lol

    [–] [email protected] 1 points 5 months ago

    tar -czf $(ls | head -n1) if we dont trust globs

    or run find in /bin or something

    [–] [email protected] 0 points 6 months ago (1 children)

    Yes. However, if you had skipped the -f, it would have been valid. Without the filename argument, it assumes it should extract from the tape drive (TAR = Tape ARchive). The tape device is probably something like /dev/rmt0, but you don't need to specify that. Using the -f is technically an exception which means "instead of extracting from the tape like you'd normally do, pretend that this file is the tape device instead."

    [–] [email protected] 0 points 6 months ago* (last edited 6 months ago) (1 children)

    GNU tar, at least a modern one, that is the one that happens to come with my system, won't try to read from /dev but stdin and then complain that it's a terminal and refuse.

    Quoth POSIX on the f flag:

    Use the first file operand [...] as the name of the archive instead of the system-dependent default.

    That is GNU is compliant, here, the default is system-dependent. f - is required to be stdin, though, so you can bunzip2 foo.tar.bz2 | tar xf - or such in a portable manner, don't have to rely on tar having a z option (which is nonstandard) or it auto-detecting compression (even more nonstandard). What is not standard either is tar -x: Tar doesn't take leading hyphens. Tar is one of those programs so old its command line syntax got standardised before command line syntax standards were established. OTOH it's not nearly as bad as dd, you can interpret how tar does things in the same way as git pull: It's a subcommand, not a flag.

    [–] [email protected] 1 points 5 months ago (1 children)

    "one of those programs so old its...syntax got standardized before command line syntax standards were established." --This is wild to learn, but also confusing. How does tar not take leading hyphens, but I've only ever used it as such without error of any kind? Not even bragging I've been doing that for 10+ years too lol

    [–] [email protected] 2 points 5 months ago* (last edited 5 months ago)

    Hmm. Actually you prompted me to dig a bit deeper: tar goes all the back to Version 7 UNIX, 1979, but the command line syntax is shared with tap, included in Version 1, man page dated to 1971-11-03. Development of C started 1972. Might've been written in B, you'd have to unearth a source archive I bet it's around somewhere. But anyway if you look through the other Version 1 commands a lot of them don't take hyphen commands, ls does, e.g. rm doesn't on account of only taking file names as arguments.

    dd is actually younger, Version 5, 1974, the syntax apparantly comes from IBM's JCL.

    Admittedly, that's all before my time.

    Both BSD and GNU tar take hyphens, I don't really have any experience with anything else but a short stint with Solaris in the early 2000s (very emphatically before Sun got gobbled up by Oracle) and I don't remember hyphens tripping me up. Much unlike killall. And I'm apparently not alone in that.

    [–] [email protected] 0 points 6 months ago (1 children)
    [–] [email protected] 0 points 6 months ago

    That's what I had in mind too. Tar's arguments are really intuitive.

    x - eXtract

    z - use gZip

    v - Verbose

    f - File (requires the path as an argument)