A tar file, often called a tarball, is a collection of files wrapped up in one single file for easy storage. Rather than keep track of a whole folder of files, you only need to keep track of one. Tar files are often compressed after being created, giving it the .tar.gz file extension. Technically these are TGZ files, but nearly everyone calls both .tar and .tar.gz files simple “tar files.”
How Do I Open a Tar File?
If you’re on macOS or Linux and don’t mind using a terminal, it’s just a single command (where tarfile is the name of your file):
tar -xzf tarfile
There are also a few flags you can add to the command to have it perform slightly different functions:
- -v: Enables verbose mode, showing the progress of the command
- -x: Extract
- -z: Uses gzip, omit this if you just have a .tar
- -f: specifies file input, rather than STDIN
Those last three flags can be a little hard to remember on the spot, so a good mnemonic to use is “Xtract Ze File.” You can also pretend you’re the Terminator when you run it.
Creating a tar file is just as easy. Just replace the -x with a -c to “Create,” though I find it easier to remember by “Compress,” even though that’s -z’s job.
An Easier Way (on macOS)
For those that don’t like using a terminal, you’ll be delighted to hear that macOS can open tar and tar.gz files by default with the Archive Utility. Just double click on the file, and it will extract.
You can also use The Unarchiver, which is a free tool for managing archives, functions just like the Archive Utility, and supports .rar files as well.
What About Windows?
On Windows, you’ll need an external program to open them. 7-Zip is lightweight and does the job well, though it takes two steps to open tar.gz files. WinRar opens them in one step but is slightly clunkier to use.
Article Source : https://ift.tt/2vLmhYX