A robust universal archive extractor for zsh that focuses on safety, predictability, and clean extraction.
Unlike simple case *.zip aliases, ext is designed to handle real-world archives:
- Path traversal protection
- Clean output directories
- Collision-free extraction
- Fallback detection for wrong or missing file extensions
- No
cdhacks, no side effects
- Supports:
tar,tar.gz,tar.xz,tar.zst,zip,7z,rar,gz,bz2,xz,zst - Detects archive type even with incorrect or missing extensions (
filefallback) - Path traversal (Zip-Slip) protection — blocks
../and absolute paths - Automatically extracts into a dedicated directory
- Collision-safe output (
foo,foo_2,foo_3, …) - Optional flags:
--list→ show archive contents without extracting--no-dir→ extract into the current directory--flat→ flatten directory structure (zip clean, 7z best-effort)--force→ reuse existing output directory
- No global shell side effects (
emulate -L zsh) - Clear error handling and exit codes
curl -fsSL https://raw.githubusercontent.com/gitclonexx/uni-extract/main/ext.zsh -o ~/.zsh/ext.zsh
echo 'source ~/.zsh/ext.zsh' >> ~/.zshrc