plugins/universalarchive/README.md
The universalarchive plugin provides a convenient command-line interface for archiving files and directories using a wide variety of compression formats - without having to remember the exact syntax for each tool.
To enable it, add universalarchive to the plugins array in your .zshrc file:
plugins=(... universalarchive)
Basic command format:
ua <format> <files...>
<format>: the archive format to use (e.g., zip, tar.gz, xz, 7z, etc.)<files...>: one or more files or directories to compressCompresses notes.txt and images into notes.zip
ua zip notes.txt images/
Creates myproject.tar.gz
ua tar.gz myproject/
Compresses all .log files into current_folder.xz
ua xz *.log
The plugin will generate a default archive filename based on the input:
If the output file already exists, a unique filename is generated using mktemp.
| Format | Description | Tool Used |
|---|---|---|
7z | 7zip archive | 7z |
bz2 | Bzip2-compressed file | bzip2 |
gz | Gzip-compressed file | gzip |
lzma | LZMA-compressed file | lzma |
lzo | LZO-compressed file | lzop |
rar | WinRAR archive | rar |
tar | Uncompressed tarball | tar |
tbz,tar.bz2 | Tarball compressed with Bzip2 | tar + bzip2 |
tgz,tar.gz | Tarball compressed with Gzip | tar + gzip |
tlz,tar.lzma | Tarball compressed with LZMA | tar + lzma |
txz,tar.xz | Tarball compressed with LZMA2 | tar + xz |
tZ,tar.Z | Tarball compressed with LZW | tar + compress |
xz | XZ-compressed file | xz |
Z | LZW-compressed file | compress |
zip | Standard Zip archive | zip |
zst | Zstandard-compressed file | zstd |
Note: Some formats may require specific tools to be installed on your system (e.g.
7z,rar,lzop,zstd). Make sure these tools are available in your$PATH.
The plugin provides tab-completion for supported formats and input files. Type ua <TAB> to see available formats, and ua <format> <TAB> to browse files.