tar

CLI

Create, list, and extract .tar / .tar.gz archives. Preinstalled on macOS and Linux.

Bundle directories into .tgz release artifacts and unpack them

4 of 4 recipes verified by execution · 2026-09-17#archive#compress#tgz#extract

Verified commands

Executed by our harness on the platforms shown; the assertion checked the actual result, not just the exit code.

Create a .tgz from a directory's contents

Verified macOS · Linux · 2026-09-17
tar -czf out.tgz -C project .
Common failures (1)
  • archive contains a top-level 'project/' folder-C project . archives the contents; 'tar -czf out.tgz project' archives the folder itself

List the files inside a .tgz

Verified macOS · Linux · 2026-09-17
tar -tzf archive.tgz

Extract a .tgz into a directory

Verified macOS · Linux · 2026-09-17
mkdir -p out && tar -xzf archive.tgz -C out
Common failures (1)
  • tar: out: Cannot open: No such file or directorythe target directory must exist: mkdir -p out first

Extract a release archive dropping its top-level folder

Verified macOS · Linux · 2026-09-17
mkdir -p out && tar -xzf release.tgz --strip-components=1 -C out

Install

Homebrewbrew install gnu-tar
aptsudo apt install tar

Agent notes

When to use
Packaging build output, unpacking downloaded releases
Quick examples
  • tar -czf out.tgz -C dir .
  • tar -xzf archive.tgz -C dest

Use from an agent

curl -s https://clihub.com/api/tools/tar | jq '.agentHints.provenRecipes[] | {task, command, verified}'

Or call get_tool with slug tar on the MCP server at https://clihub.com/mcp.

Homepage ↗GPL-3.00 views