News for hackers. Stuff that matters.
Re:Shell.how: Explain Shell Commands by bmarswalker on Saturday August 24, 2024 @10:25PM (#41343811)
I tried

    tar xvzf 1.zip
and got

    xvzf: is neither a valid subcommand, option, or argument.
Re:Shell.how: Explain Shell Commands by SomewhatLikely on Saturday August 24, 2024 @11:37PM (#41344159)
I've switched to LLM's for explaining commands. Here's ChatGPT4o:

The command tar xvzf 1.zip appears to be trying to extract a compressed archive file, but there's a mismatch between the file extension (1.zip) and the command options used for tar. Let me break it down:

tar: This is the command-line utility for working with tar archives (tape archives). It can be used to create, extract, and manipulate tar files.

x: This option tells tar to extract files from an archive.

v: This stands for "verbose", which means that tar will list the files being extracted to the terminal.

z: This option tells tar to handle a compressed archive using gzip. It is typically used with .tar.gz or .tgz files.

f: This tells tar that the next argument is the name of the archive file.

However, the file 1.zip is a ZIP file, not a tar.gz file. ZIP files are handled by the unzip command, not tar. Using tar xvzf on a .zip file would result in an error, as tar expects a .tar.gz file when using the z option.

To properly extract a .zip file, you should use:

unzip 1.zip

This command will extract the contents of the ZIP file.

Re:Shell.how: Explain Shell Commands by compootr on Sunday August 25, 2024 @12:10AM (#41344316)
bruh. why did we need to involve llms?

you could do a man pages on steroids — i.e explains what the args do

a tiny asterisk is that llms will hallucinate and spit out bs

Re:Shell.how: Explain Shell Commands by jchw on Sunday August 25, 2024 @01:01AM (#41344527)
Well it got the flags right, but it's kind of wrong too. I mean it's true that GNU tar will not handle a Zip archive, but libarchive BSD tar is more than happy to handle most common archive formats, including Zip archives.

    $ tar -a -cvf file.zip a.exe
    a a.exe

    $ file file.zip
    file.zip: Zip archive data, at least v2.0 to extract, compression method=deflate

    $ tar xvf file.zip
    x a.exe
This may seem like a silly catch-22, but the truth is a lot of people who will need to ask questions like this are in fact likely to encounter BSD tar. macOS ships with BSD tar with Zip support, and I believe even Windows does nowadays. I don't think you'll have an unzip command in vanilla Windows so that could easily waste someone's time if they didn't realize it.
Re:Shell.how: Explain Shell Commands by ziofill on Saturday August 24, 2024 @10:35PM (#41343867)
Re:Shell.how: Explain Shell Commands by jmercouris on Sunday August 25, 2024 @12:45AM (#41344456)
Isn't it true that you must provide the hyphen before `xvzf`?
Re:Shell.how: Explain Shell Commands by jchw on Sunday August 25, 2024 @01:06AM (#41344548)
Actually no. All tar implementations I know of support "old" style options.

https://www.gnu.org/software/tar/manual/html_section/Styles....

I don't know the exact history of how this options style came to be, but I assume it's probably some really ancient UNIX thing.

Re:Shell.how: Explain Shell Commands by begueradj on Sunday August 25, 2024 @11:13AM (#41347857)
You are right. And it seems that's the case with several other arguments that follows `tar`such as `cvf`, `xvf`, `czvf`...etc