shar
Create self-extracting shell archives
TLDR
SYNOPSIS
shar [OPTIONS] [file...]
DESCRIPTION
shar (shell archive) creates self-extracting archive files that can be unpacked by running them through /bin/sh. The archive is a plain text shell script containing the encoded file data, making it suitable for transmission via email or posting to text-based systems.Archives can contain multiple files and directories, with options for compression, binary encoding via uuencode, and splitting into multiple parts for size-limited transmission. To extract, run the archive with sh archive.sh or make it executable and run directly.
PARAMETERS
-V, --vanilla-operation
Create minimal archives using only echo, test, sed-B, --uuencode
Force uuencoding of all files (treat as binary)-T, --text-files
Treat all input files as text-M, --mixed-uuencode
Auto-detect binary vs text files (default)-C, --compactor program
Compress files using gzip, bzip2, xz, or compress-g, --level-of-compression num
Compression level 1-9 (default: 9)-o, --output-prefix str
Save to numbered files (prefix.01, prefix.02, etc.)-L, --split-size-limit num
Split archives to specified size-n, --archive-name str
Document archive with name in headers-c, --cut-mark
Start output with cut line-a, --net-headers
Add Submitted-by and Archive-name headers-x, --no-check-existing
Overwrite files without prompting on extraction-m, --no-timestamp
Skip restoration of file modification times-q, --quiet
Suppress progress messages-h, --help
Display usage information
CAVEATS
Shell archives execute shell commands during extraction, posing security risks with untrusted sources. Always inspect shar files before running. Large binary files significantly increase archive size even with uuencoding. Modern alternatives like tar with compression are generally preferred for file distribution.
HISTORY
The shar format originated in the early 1980s Unix community as a way to distribute source code via Usenet and email before binary attachments were common. GNU sharutils, containing shar and unshar, was developed as part of the GNU project. While largely superseded by modern archive formats, shar remains useful for distributing small text-based packages.
