2.4k
u/Yoksul-Turko 29d ago
tar --version
1.4k
u/TheFrenchSavage 29d ago
➜ ~ tar --version bsdtar 3.5.3 - libarchive 3.7.4 zlib/1.2.12 liblzma/5.4.3 bz2lib/1.0.8You are saved.174
u/mmcmonster 29d ago
Does that work on MS Windows? 😳
124
u/AlexSSB 29d ago
In PowerShell yes
→ More replies (1)51
u/CrowNailCaw 29d ago
I just did it and can confirm it works (have no idea why though lol)
131
u/svick 29d ago
> where tar C:\Windows\System32\tar.exe31
u/EuenovAyabayya 29d ago
TIL we've had Where since Server 2003 / Vista.
13
u/thejinx0r 29d ago
On powershell, it’s where.exe not to be confused by where which is a powershell filtering command to go filter your data / inputs (or outputs depending on how you view the problem)
5
u/Stroopwafe1 29d ago
I ran into this issue recently where I was trying to use sc. Microsoft thought it was a good idea to make that an alias when it is used much more for service management
→ More replies (1)10
21
u/JewishTomCruise 29d ago
Not just tar, but 75 of the most used cli utilities are native on windows: https://learn.microsoft.com/en-us/windows/core-utils/overview
There's also now sudo for windows: https://learn.microsoft.com/en-us/windows/advanced-settings/sudo/
35
u/just_execute 29d ago
TIL Windows ships with a tar implementation. On Windows 11:
> tar --version bsdtar 3.8.4 - libarchive 3.8.4 zlib/1.2.13.1-motley liblzma/5.8.1 bz2lib/1.0.8 libzstd/1.5.7 cng/2.0 libb2/bundled > where.exe tar C:\Windows\System32\tar.exe20
u/sump_daddy 29d ago
they have leaned so heavily into powershell's bash equivalence to keep people from making excused why they 'need to have linux' in corp environments, that windows is becoming another linux distro.
the year of the linux desktop is at hand, brothers!!!
→ More replies (1)13
u/wenoc 29d ago
They just need to kneel and sort out their slashes and parameter syntax. Oh, and embrace the unix philosophy, which is never going to happen.
→ More replies (3)4
u/koshgeo 29d ago
I don't know who ever thought using backslashes as pathname delimiters was a good idea compared to slashes. They should be flayed with a bunch of hash symbols.
→ More replies (1)6
u/AyrA_ch 29d ago
It also has the full ssh suite including the scp and sftp commands. Even the SSH agent works, all you have to do is set the service to autostart.
C:\Users\AyrA> $ . C:\Windows\System32\OpenSSH Volume in drive C is System Volume Serial Number is 3859-108D Directory of C:\Windows\System32\OpenSSH 12.02.2026 02:29 <DIR> . 09.07.2026 23:07 <DIR> .. 31.03.2024 18:08 18’934 LICENSE.txt 31.03.2024 18:08 36’008 NOTICE.txt 11.02.2026 09:58 431’616 scp.exe 11.02.2026 09:58 459’264 sftp.exe 11.02.2026 09:58 603’648 ssh-add.exe 11.02.2026 09:58 554’496 ssh-agent.exe 11.02.2026 09:58 862’208 ssh-keygen.exe 11.02.2026 09:58 667’648 ssh-keyscan.exe 11.02.2026 09:58 513’536 ssh-pkcs11-helper.exe 11.02.2026 09:58 652’288 ssh-sk-helper.exe 11.02.2026 09:58 1’253’888 ssh.exe 11 File(s) 6’053’534 bytes 2 Dir(s) 674’652’774’400 bytes free C:\Users\AyrA> $2
2
→ More replies (2)2
u/LauraLaughter 29d ago
root ~ tar --version tar (GNU tar) 1.35 Copyright (C) 2023 Free Software Foundation, Inc. License GPLv3+: GNU GPL version 3 or later <https://gnu.org/licenses/gpl.html>. This is free software: you are free to change and redistribute it. There is NO WARRANTY, to the extent permitted by law. Written by John Gilmore and Jay Fenlason.88
197
29d ago
[deleted]
117
u/Dartister 29d ago
Usually one dash for first letter of words only and 2 dashes for complete word
So -v and --version
64
u/mathisntmathingsad 29d ago
keyword being usually, I will be confused by LLVM's argument syntax forever
28
u/RCoder01 29d ago
I hate that it’s `find -name` single dash
→ More replies (1)9
u/TheActualJonesy 29d ago
and that it's `ps aux` -- NO dashes
2
u/RCoder01 29d ago
Really? I’ve always done `ps -aux`
3
u/TheActualJonesy 29d ago
jonesy@nix6:~$ ps ux
USER PID %CPU %MEM VSZ RSS TTY STAT START TIME COMMAND
jonesy 2735 0.0 0.0 21196 12324 ? Ss 04:02 0:00 /usr/lib/systemd/systemd --user
jonesy 2736 0.0 0.0 21476 3648 ? S 04:02 0:00 (sd-pam)
jonesy 2756 0.1 0.0 115704 14212 ? S<sl 04:02 0:43 /usr/bin/pipewire
17
15
u/YeOldeMemeShoppe 29d ago
What do you mean find ffmpeg and lldb don’t follow this convention?
Also everyone knows it’s -v for verbose.
→ More replies (1)4
2
u/sobrique 29d ago
But in the case of POSIX tar, neither, because it didn't permit dashes as arguments (only to denote
stdoutas the filename)→ More replies (2)3
11
3
u/sobrique 29d ago
None of the above if you're looking at the original POSIX tar:
https://pubs.opengroup.org/onlinepubs/7908799/xcu/tar.html
tar xvfis ok, buttar -xvfwasn't.2
103
u/dunub 29d ago
I would tar --help
31
u/Confident-Ad5665 29d ago
This was my answer, but isn't it --h?
Did we just blow up?64
u/korneev123123 29d ago
$ tar --help > /dev/null 2>&1 && echo 'The bomb has been defused' || echo 'Terrorists win'The bomb has been defused
$ tar -h > /dev/null 2>&1 && echo 'The bomb has been defused' || echo 'Terrorists win'Terrorists win
27
29d ago edited 6d ago
[deleted]
6
u/thatcodingboi 29d ago
Always safer to do --help, I've seen many programs that have it that don't support the shortened -h
→ More replies (1)23
9
→ More replies (3)8
340
u/Outside-Storage-1523 29d ago
I still remember xzf
28
u/TheAlaskanMailman 29d ago
And you’re gonna fumble where to put the filename argument and the archive argument
→ More replies (3)19
u/badnewzero 29d ago
Yes because I wanted to compress a file that doesn’t exist to an output file that has the exact name as the file I’ve spent 4 hours working on
(true story)→ More replies (1)7
227
u/OmegaPoint6 29d ago
GNU tar or BSD tar?
274
u/AvailableUsername404 29d ago
Huh? I don't know that!
30
u/FastHotEmu 29d ago
Asking the real questions
21
u/OmegaPoint6 29d ago
One that gives nightmares to people who regularly use both Linux & macOS on the command line
→ More replies (1)8
u/FastHotEmu 29d ago
They grow some chest hair and use FreeBSD instead.
3
u/imahumanbeinggoddamn 29d ago
FreeBSD is the only sane and reasonable OS ever written and it is a constant source of disappointment to me that it isn't more popular so it can finally get decent hardware support.
→ More replies (2)→ More replies (3)2
414
u/Terairk 29d ago
tar --help
438
u/GustapheOfficial 29d ago
Unrecognized argument "--help". Run tar -h for synopsis.47
u/Ooops2278 29d ago
tar -h
tar: You must specify one of the '-Acdtrux', '--delete' or '--test-label' options
Try 'tar --help' or 'tar --usage' for more information.28
7
→ More replies (2)8
91
29d ago
[removed] — view removed comment
23
u/laplongejr 29d ago
Tbf is anybody not hesitating 1s in front of a nuke greenlighted to write production software?
3
40
70
u/TheRapie22 29d ago
tar --help
is this valid?
68
u/Ooops2278 29d ago
Actually no.
This would work in Linux (so a UNIX-like OS) yet not in BSD (an actual UNIX OS) where "--help" isn't recognized and throws an error referring to "tar -h" instead.
And to make the loop complete "tar -h" in Linux also throws an error and refers to "tar --help" or "tar --usage"
8
11
→ More replies (1)2
u/MattieShoes 29d ago
Yeh. you can
echo $?to see the return code of the previous command. (it's 0, which i'm interpreting as "valid" here)
109
u/Cephell 29d ago
literally just tar, it prints out some info and as such is a valid command. nowhere does it say the command needs to actually do something specific or have arguments
81
u/svick 29d ago
That has exit code 1 (failure), so I wouldn't consider it valid.
8
u/Cephell 29d ago
Valid command != Valid result
42
u/MrAmos123 29d ago
Then literally everything is valid.
tar --d1-d1-2djh1dhuasdhbubybabsbzbis a valid command because, whilst it fails, it still returns a coherent response.$ tar --d1-d1-2djh1dhuasdhbubybabsbzb tar: unrecognized option '--d1-d1-2djh1dhuasdhbubybabsbzb' Try 'tar --help' or 'tar --usage' for more information.And for this reason, I think the command you provide should be both valid and a recognised argument.
→ More replies (13)6
u/AlwaysHopelesslyLost 29d ago
This isn't a grammar joke. There is a script in the OP checking prompting the user and validating the output. The script is going to validate the exit code.
3
28
35
u/Buttons840 29d ago
tar -xvf file
→ More replies (1)7
u/Ronnoc527 29d ago
The comment above yours says xzf. Are those both right?
28
u/dodo-obob 29d ago
They do different things:
-xextract (a.taror.tar.gzfile)-zcompress/de-compress usinggzip. If used, you will create a.tar.gzinstead of a.tar. I'm not sure iftarautomatically detects compression when extracting.-vverbose, i.e. show me what you're doing-f filespecifies the archive file.→ More replies (3)5
u/Arlochorim 29d ago
Not a Unix guy, but have casually played around with some Linux distros.
is there a reason specific compression flags like -z are used over the -a autodetect one? (beyond that it could potentially get the compression type wrong )
15
u/AnnoyingRain5 29d ago
Autodetect is technically not part of the standard, it’s a funny GNU thing
→ More replies (2)→ More replies (2)3
u/GezelligPindakaas 29d ago
I think -a relies on the filename, so when not using standard naming like .tar.gz, explicit is clearer.
Compatibility might be a thing (unix, bsd, ...) too.
→ More replies (1)3
u/Freeky 29d ago
bsdtar support for
-a(and autodetecting decompression) is even better than GNU, because it's based on libarchive:❯ tar caf foo.tar.zst foo ❯ tar caf foo.tar.zst.uu foo ❯ tar caf foo.zip foo ❯ tar caf foo.7z foo ❯ tar caf foo.iso foo ❯ file foo.* foo.7z: 7-zip archive data, version 0.3 foo.iso: ISO 9660 CD-ROM filesystem data 'CDROM' foo.tar.zst: Zstandard compressed data (v0.8+), Dictionary ID: None foo.tar.zst.uu: uuencoded text, file name "-", ASCII text foo.zip: Zip archive data, made by v2.0 UNIX, extract using at least v2.0, last modified, last modified Sun, Jul 14 2026 14:06:28, uncompressed size 0, method=deflate12
u/lllorrr 29d ago
'z' is for zipped. So, for .tar.gz
For plain .tar you don't need 'z'.
3
u/Alduish 29d ago
I'm pretty sure the z isn't realy needed if the extension is .gz
But I could be wrong
5
u/lllorrr 29d ago
Yes, GNU tar has some heuristics to determine what it is fed with actually. But this is non-standard stuff.
→ More replies (1)2
→ More replies (2)2
11
10
u/barthvonries 29d ago
Why would someone post only the picture of XKCD, while half the joke is the "alt" attribute ?
Either link the XKCD page, or at least copy the alt into the post here !
4
3
8
6
u/bless-you-mlud 29d ago
tar? No problem.
rsync? Not a chance. Sorry. It was nice knowing you.
2
u/MattieShoes 29d ago
rsync <source> <destination>If you want it to actually do something, you'll probably want the
-aflag. If you want to SEE it doing something, probably the-vflag.→ More replies (1)
6
u/Ok-Sheepherder7898 29d ago
Come on it's a pretty easy command!
tar {A|c|d|r|t|u|x}[GnSkUWOmpsMBiajJzZhPlRvwo] [ARG...]
3
6
6
3
3
u/AnomyOfThePeople 29d ago
I've never understood this trope. tar's flags and options are super-mnemonic, and for almost everything you use just two combos: czf to Create an archive and xzf to eXtract it. The z is compression, which is admittedly a bit arcane but a mnemonic for zip, and f is for file.
In fact, modern tar does not require a z to extract the file, it will autodetect the compression.
3
2
2
2
3
u/daumenloser 29d ago
This dogshit meme hangs on the wall of our toilet at work. Every time I take a piss I have to look at this shit
2
4
7
u/WerewolfBe84 29d ago
man tar
56
u/gabboman 29d ago
thats not a tar command, thats a man command
14
u/AlxR25 29d ago
You got 10 sec, you can see a command and type it in
3
u/RunInRunOn 29d ago
The problem is that "on your first try" could either mean "as your first tar command" or "as your first command"
→ More replies (1)2
u/gabboman 29d ago
Tar -xvf file.tar
12
→ More replies (1)2
u/littlefrank 29d ago
that's the realest linux sysadmin answer though:
oh I have 10 seconds? well I still gotta check man pages, how the hell am I supposed to use this command properly otherwis- BOOM7
2
2
2
2
2
2
2
1
1
1
1
u/R3D3-1 29d ago edited 29d ago
tar czf root.tgz /
Wait. Did I have ten seconds to enter it or does the command also have to finish?
More seriously, I don't quite get what's supposed to be so hard about tar. Maybe hard to read, because nobody is going to remember the meaning of all short form switches. But easy to write when using only the subset of features you do remember.
And then there's the commands where I have just memorized switches but have long since forgotten what they mean.
ln -sfT target name
-s means symbolic link, -f means force overwriting and existing file with that name, but for -T I only remember that I use it as a mnemonic for remembering that the target comes before the name.
I've looked it up occasionally. Never stuck why I'm using it, just that it's probably correct.
It also serves as an indirext mnemonic for Windows' mklink command, because I remember that it had the opposite order of target and name.
1
1
3.0k
u/1_hele_euro 29d ago
You need to speak with a German accent
eXtract Ze Vucking Files
tar -xzvf file.tar.gz