img title=“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.”
Wouldn’t tar --help suffice? Afaik, it returns exit code 0.
Depends. Is it GNU tar, BSD tar or some old school Unix tar?
Double hyphen “long options” are a typical GNU thing.
That’s why those commands have two?
Yes, the terse Unix version, which needs to be supported for compatibility, and the more readable GNU long option
tar -h?
~# tar -h tar: You must specify one of the '-Acdtrux', '--delete' or '--test-label' options Try 'tar --help' or 'tar --usage' for more information. *********************************************** WARNING: Self destruct sequence initiated ***********************************************
~# tar -h || tar --help
Ugh. Bsdtar:
-h (c and r modes only) Synonym for -L.
But it has --help too.
A little trick I learned on here was to imagine yourself as a little evil man saying “Extract ze files!” in a German accent. Extract ze files >>> xzf.
Only works for tar.gz. Remember there’s also tar.xz, tar.bz, tar.bz2 and half have their own extractor flag. FUN. It’s usually J.
The post only calls for “a valid tar command”, not that it has to work for any specific circumstance.
xaf
(extract a file) auto-detects the format.Extract Any File
Extract All Files
I don’t remember the last time I had to worry about the compression. I simply run
tar xf myfile.tar.whatever
and it works every time.
I still use that. 😅
That sounds a lot like Czech, “ze” means “from” if you translate it into English
Looks, not sounds. Ahoj!
tar xzvf file.tar.gz
I got it memorized after installing gentoo over and over again from stage 3 back in 2005Normally I would say view the man page (as a command). Though for some reason when making the thinnest distro possible, the OS team at my job got rid of man.
Wtf man.
man wtf
Surely
tar --help
is a valid tar command, right?tar xvf somearchive.tar
Is that right? )= I’m scared I lost.
Yep that’s valid.
user@server:~> tar xvf somearchive.tar
tar: somearchive.tar: Cannot open: No such file or directory
tar: Error is not recoverable: exiting now
Scheiße…
vim -tvf
is a favorite of mine.tar
Done. That’s a valid command, no error code, nothing. KISS!
false
tar: You must specify one of the '-Acdtrux', '--delete' or '--test-label' options Try 'tar --help' or 'tar --usage' for more information. zsh: exit 2 tar
tar --help
💥
OK now I have to escape to really smart assery and assume that’s what I meant the whole time ;)
Edit code 2 describes something that went wrong - but that something telling you that it went wrong was the tar binary which therefor most have been valid to evaluate that!
Under no circumstances did I assume that the hint towards help itself would’ve been an exit code 0, no sir!
To be honest: if I’d designed that bomb it would’ve exploded in my face for trying to be too clever.
tar --help
is a valid commandFor GNU
tar
it is, for any other versions I would not be so sure. Especially when disabling an atomic bomb.More of a request than a command, I’d have argued
I command you to show me the manual
tar -cvf CowsLookLikeMaps.tar CowsLookLikeMaps
If you can’t tar to a pipe into ssh to a remote host and untar into an arbitrary location there, are you really using Unix?
I had to pipe dd through gzip over SSH recently to locally image a disk on a cloud server. That was fun.
What the fuck lmao I didn’t know that was possible
The command that I can never get right the first time is
ln
. I always end up creating a dead link inside my target folder, even when I read the man page directly prior.tar -h
I’ll take my award in all ones please
I always liked
dtrx
(do the right extraction)Btw, GNU tar has long options.