Old XKCD, still relevant
Old XKCD, still relevant
I hitched my horse to just what I consider the basicsāzip and unzipāand that has made it easy for me. But Iāve been stuck on those.
Extract anything:
tar xf <archive_file>Create a tbz2 archive:
tar cjf <archive_file.tbz2> <stuff to put in it>(And tossing in a -v is pretty universal, if thatās your thing.)
Some day, instead of commenting on a reddit Lemmy post, I think Iāll Google how to tell it to use .xz.
Ok, you know what? Today is finally that day. Itās just capital -J instead of lower-case -j! Thatās easy enough to remember, I guess.
tar on a meme post.
man tar is cheating, but it is a command involving tar. Not a command using tar, but a tar commandā¦
tar --help would technically be a valid invoking of the binary itself if man tar doesn't
But it would not work on older non-GNU versions of tar.
GNU introduced the āāfooā style long options, and it was a long time before Unix versions began adopting them.
curl cheat.sh/tar
tar xvzf but can't even remember what it's supposed to do.
eXtract, Verbose, gZip, File.
Not sure why it doesnāt need the dash though.
The dash used to be how to could tell how long someone had been using tar. If they started with Linux, they probably use a dash. If they started on a UNIX variant, they probably donāt. Either way, the dash isnāt needed.
Also recently learned that recent versions of tar will autodetect compression. So for extraction, you just need ātar xf ā
tar cJf file.tar.xz /path/to/file
tar xJf file.tar.xz /path/to/file.tar.xz -C /path/to/untar
is not very hard to remember
tar -czvf tar_name.tar.gz ./
c because that means ācreateā an archive, and youāre missing a z which applies gzip decompression/compression
I suppose it is tar version dependent, but on any recent Linux version I have used, you can just tar xvf <tar_name.tar.{z,gz,xz,etc}> and it will automatically figure out if it is compressed, what tools were used to compress it, and how to decompress it.
But you are right, x and c are mutually exclusive.
valid tar command
Somehow, idk why. This one is stuck in my head:
tar -zxvf filename.tar.gzSame, never used a mnemonic for it or anything, just
zxvf
Like itās any other word
verbose ⦠not needed?
If the words donāt happen how can I trust computer magic?
tar zxvf filename.tar.gz file?
tar doesnāt handle compression on AIX. So it would be something like gzip -cd filename.tar.gz | tar xvf -
tar, no arguments. Does nothing, still a valid command, no?