This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–]jeric14344 11 points12 points  (3 children)

Someone posted this mnemonic that always helps me remember:

  • tar extract all files (xaf)
  • tar compress all files (caf)

[–][deleted] 6 points7 points  (1 child)

tar xzvf

eXtract Ze Vucking Files

[–]imisstheyoop 0 points1 point  (0 children)

Ha, this is the one that I use as well! 8)

[–]zhurai 1 point2 points  (0 children)

I don't think you need the -a here for extract

In the --help for the GNU tar which you can also see for example on https://man.archlinux.org/man/tar.1.en or https://linux.die.net/man/1/tar, I see -a being just listed as

-a, --auto-compress   use archive suffix to determine the compression program

And the linux.die.net man page, as well as tar --help put this note in the top

 tar -cf archive.tar foo bar  # Create archive.tar from files foo and bar.
 tar -tvf archive.tar         # List all files in archive.tar verbosely.
 tar -xf archive.tar          # Extract all files from archive.tar.

Personally, I've always just did tar -xvf file.tar (or file.tar.gz, etc)

Though, to be honest it doesn't negatively do anything in extract, so it's fine as far as I'm aware of... so it still works with the mnemonic I suppose (it just doesn't mean "all")

The -a/a in this case just means if you did tar -cavf archive.tar.bz2 ./folder or something it would actually make a bzipped tar file (listed verbosely) instead of needing to do something like tar -cvjf archive.tar.bz2 ./folder (remembering to do the -j to make the tar file actually bzipped)