How to extract RAR, tar.gz, jar, and other archive formats
Beyond zip — every other archive format you'll meet (RAR, 7z, tar.gz, gz, jar, war, ear) and the right tool for each on every OS.
Zip is the default, but plenty of other archive formats turn up — usually because the source picked the format that compressed best for its content. Each one needs a specific tool, and most of them are free.
RAR
Proprietary format from WinRAR. The official extractor (WinRAR on Windows, RAR on Linux/Mac CLI) is the safest. Free alternatives that handle RAR cleanly: 7-Zip (Windows, Linux), The Unarchiver (Mac), unrar (Linux CLI).
Command line: unrar x archive.rar — note that x preserves the directory structure inside; e flattens it.
7z (7-Zip native)
Best compression of the common formats. 7-Zip handles it natively on Windows. Mac: install Keka or The Unarchiver. Linux: 7z x archive.7z (after apt install p7zip-full).
tar.gz, .tgz, .tar.bz2, .tar.xz
Tar bundles many files into one (no compression); gz, bz2, and xz compress that bundle. The unified command:
tar -xf archive.tar.gz
Modern tar auto-detects the compression. Add -v for verbose listing as it extracts. Add -C /path/to/dest to unpack somewhere other than the current directory.
On Windows, tar is built into Windows 10 and 11 — open PowerShell and use the same command. Or use 7-Zip's GUI which handles every variant.
Plain .gz (single file)
gunzip file.gz produces file (the original name, decompressed). The .gz extension is dropped in place. To keep the .gz too, use gunzip -k file.gz.
JAR, WAR, EAR (Java archives)
These are zip files with a different extension. Any zip extractor works: jar xf foo.jar (Java's CLI), unzip foo.jar, or rename to .zip and double-click. The internal META-INF/ folder identifies the bundle as a Java archive — keep it intact if you're going to repackage.
ISO, DMG (disk images)
- ISO: Windows 10/11 — right-click → Mount; macOS — double-click; Linux — sudo mount -o loop file.iso /mnt/iso.
- DMG (macOS): double-click to mount. To extract on Linux, install dmg2img and convert to ISO first.
Beyond extracting
Once you've extracted the archive, the files inside are ordinary files. If the archive was a bundle of PDFs (annual reports, receipts, contracts) you need to process, ExtractFox handles the next step — pick the matching extractor for the document type.