Shar
m |
(Expand on shar variances, and suggest running shar inside a virtualized environment.) |
||
(4 intermediate revisions by 3 users not shown) | |||
Line 1: | Line 1: | ||
{{FormatInfo | {{FormatInfo | ||
+ | |name=shar | ||
|formattype=electronic | |formattype=electronic | ||
|subcat=Archiving | |subcat=Archiving | ||
− | |extensions={{ext|shar}} | + | |extensions={{ext|shar}}, {{ext|sha}} |
+ | |pronom={{PRONOM|fmt/329}} | ||
}} | }} | ||
'''shar''' is a self-extracting archive format for Unix-type systems. It encodes a group of files in a text-based format embedded in a [[Bourne shell script|shell script]] which may be executed directly from the command line in order to re-create the files that were archived. | '''shar''' is a self-extracting archive format for Unix-type systems. It encodes a group of files in a text-based format embedded in a [[Bourne shell script|shell script]] which may be executed directly from the command line in order to re-create the files that were archived. | ||
− | There are many variant forms of shar archives, and there is no simple algorithm to extract files from all of them. Theoretically, it could require the full power of a Unix shell program, and the availability of every common Unix utility program. | + | There are many variant forms of shar archives, and there is no simple algorithm to extract files from all of them. Theoretically, it could require the full power of a Unix shell program, and the availability of every common Unix utility program. Variance in the environment that was used to create the shar file can result in receiving mixed results when it is to be extracted under a different environment, e.g. a shar file created under *BSD may produce warnings about <code>touch</code> syntax not supported under Linux, if the shar file contains lines containing <code>touch -am ...</code>, or legacy timestamp format, <code>MODYYYRHHMM</code>, where <code>MO</code> represents month, <code>DY</code> represents day, <code>YR</code> represents year, <code>HH</code> represents the hour in 24 hour format, and <code>MM</code> represents minutes, in numerical format, and year being the last two digits, e.g. <code>81</code> would make it <code>1981</code>. |
− | '''Security warning''': The usual ways of extracting from shar archives involve executing arbitrary code contained in the shar file. | + | '''Security warning''': The usual ways of extracting from shar archives involve executing arbitrary code contained in the shar file. It is wiser to extract shar files inside a virtualized environment, with the appropriate guest operating system, e.g. FreeBSD. |
== Examples == | == Examples == | ||
Line 25: | Line 27: | ||
== Sample files == | == Sample files == | ||
* http://ftp.gnu.org/gnu/tar/ → *.shar* | * http://ftp.gnu.org/gnu/tar/ → *.shar* | ||
+ | * http://cd.textfiles.com/carousel344/MACTOSH/UNIX/ → *.SHA | ||
+ | * {{DexvertSamples|archive/shar}} | ||
== References == | == References == | ||
* [[Wikipedia:shar|Wikipedia article]] | * [[Wikipedia:shar|Wikipedia article]] | ||
* Linux man pages: [http://linux.die.net/man/1/shar shar], [http://linux.die.net/man/1/unshar unshar] | * Linux man pages: [http://linux.die.net/man/1/shar shar], [http://linux.die.net/man/1/unshar unshar] |
Latest revision as of 17:46, 29 July 2025
shar is a self-extracting archive format for Unix-type systems. It encodes a group of files in a text-based format embedded in a shell script which may be executed directly from the command line in order to re-create the files that were archived.
There are many variant forms of shar archives, and there is no simple algorithm to extract files from all of them. Theoretically, it could require the full power of a Unix shell program, and the availability of every common Unix utility program. Variance in the environment that was used to create the shar file can result in receiving mixed results when it is to be extracted under a different environment, e.g. a shar file created under *BSD may produce warnings about touch
syntax not supported under Linux, if the shar file contains lines containing touch -am ...
, or legacy timestamp format, MODYYYRHHMM
, where MO
represents month, DY
represents day, YR
represents year, HH
represents the hour in 24 hour format, and MM
represents minutes, in numerical format, and year being the last two digits, e.g. 81
would make it 1981
.
Security warning: The usual ways of extracting from shar archives involve executing arbitrary code contained in the shar file. It is wiser to extract shar files inside a virtualized environment, with the appropriate guest operating system, e.g. FreeBSD.
Contents |
[edit] Examples
To extract the files in a shar archive:
$ sh example.shar
Another way to extract files. This also handles shar files that begin with email headers or other extraneous data.
$ unshar example.shar
[edit] Software
- shar files can be executed using a Unix Bourne-compatible shell (
sh
), and standard Unix utilities (particularlysed
). - GNU sharutils
- ppt/unshar: A perl script that tries to safely extract from shar files
- SharUtils for Windows
[edit] Sample files
- http://ftp.gnu.org/gnu/tar/ → *.shar*
- http://cd.textfiles.com/carousel344/MACTOSH/UNIX/ → *.SHA
- dexvert samples — archive/shar
[edit] References
- Wikipedia article
- Linux man pages: shar, unshar