Windows
Linux
File Management
Archives & Compression
Windows tar.exe -xf equivalent in Linux
Extracts TAR, tar.gz, tar.xz and other tar-based archives.
Windows
→
tar.exe -xf
Linux equivalents
tar -xf archive.tar
tar -xf archive.tar
tar -xf archive.tar
Overview
What this command does
Extracts TAR, tar.gz, tar.xz and other tar-based archives.
Migration tip: GNU
tar usually detects compression automatically when extracting, so tar -xf works for many common TAR formats.Practical tasks
Common use cases
Extract a TAR archive
Extracts TAR, tar.gz, tar.xz and other tar-based archives.
tar -xf archive.tar
Extract a TAR archive
tar -xf archive.tar.gz -C output/
Extract into output/
tar -tf archive.tar.xz
List files without extracting
Ready to run
Copyable Linux commands
Review paths, device names, package names and permissions before running any command.
tar -xf archive.tar
mkdir -p output && tar -xf archive.tar.gz -C output/
tar -tf archive.tar.xz
Walkthrough
Examples with explanations
tar -xf archive.tar # extract a TAR archive
mkdir -p output && tar -xf archive.tar.gz -C output/ # extract into a new directory
tar -tf archive.tar.xz # preview archive contents
Reference
Common options and variations
| Command or option | Use |
|---|---|
tar -xf archive.tar | Extract a TAR archive |
tar -xf archive.tar.gz -C output/ | Extract into output/ |
tar -tf archive.tar.xz | List files without extracting |
Distro differences
Debian/Ubuntu vs Fedora vs Arch
This command is the same on Debian/Ubuntu, Fedora and Arch Linux when the relevant tool is installed.
| Distribution | Package manager / base | Equivalent command | Difference to notice |
|---|---|---|---|
| Debian/Ubuntu | same command | tar -xf archive.tar |
Same command on this distribution. |
| Fedora | same command | tar -xf archive.tar |
Same command on this distribution. |
| Arch | same command | tar -xf archive.tar |
Same command on this distribution. |
Important
What to watch out for
Archives can contain absolute or parent-directory paths. Inspect untrusted archives with tar -tf before extraction.
Keep learning