tar Command Generator
Generate tar commands to create, extract, or list archives
Getting Started with tar
## What is tar?
`tar` (tape archiver) bundles many files into a single archive, and can compress it on the way. It is the standard tool for backups and software distribution on Unix. The first argument is always an operation mode.
## How to Use
1. **Pick a Mode**: create (`-c`), extract (`-x`), or list (`-t`). 2. **Choose Compression**: gzip (`-z`), bzip2 (`-j`), or xz (`-J`). 3. **Set the Archive**: use `-f` to name the archive file. 4. **Add Paths**: files or directories to pack (create) or extract into. 5. **Copy & Run**: paste the generated command into your terminal.
Flags & Patterns
tar merges mode, compression, and flags into one short bundle:
``` tar -czvf archive.tar.gz dir/ tar -xzvf archive.tar.gz -C /target tar -tzf archive.tar.gz ```
### Common flags - `-c` — create a new archive - `-x` — extract from an archive - `-t` — list contents - `-z` — gzip (.tar.gz / .tgz) - `-j` — bzip2 (.tar.bz2) - `-J` — xz (.tar.xz) - `-v` — verbosely list files processed - `-f <file>` — use the given archive file - `-C <dir>` — change to directory before extracting
### Tips - Always put the archive name right after `-f`: `tar -xzf out.tar.gz`. - Use `-C` to extract somewhere other than the current directory. - To preserve everything (permissions, links), create as root or with the right flags.
▶What's the difference between -z, -j, and -J?
▶How do I extract into a specific directory?
If this tool has been helpful to you, consider buying me a coffee.
Buy me a coffee