← 返回命令列表

Linux command

unshar 命令

文本

复制后可按需替换文件名、目录或参数。

常用示例

Extract a shell archive

unshar [archive.shar]

Extract to specific directory

unshar -d [/path/to/directory] [archive.shar]

Overwrite existing files

unshar -c [archive.shar]

Extract from compressed archive

gzip -dc [archive.shar.gz] | unshar

Extract multiple archives from one file

unshar -e [combined.shar]

Extract from email message

unshar [message.txt]

说明

unshar extracts files from shell archives (shar files). It scans input looking for shell archive headers, then executes each archive through the shell to extract its contents. Shell archives are self-extracting scripts that contain files encoded as shell commands. They were historically used for distributing source code via email before modern archive formats became standard. When processing email messages, unshar automatically locates and extracts embedded shell archives, ignoring mail headers and signatures. Multiple archives can be concatenated and extracted with the -e option.

参数

-d, --directory _dir_
Change to directory before extracting.
-c, --overwrite
Pass -c to shar script to overwrite existing files.
-e, --exit-0
Separate archives at "exit 0" lines.
-E, --split-at _string_
Split archives at specified string.
-f, --force
Force overwrite without prompting.
-h, --help
Display help.
-V, --version
Display version.

FAQ

What is the unshar command used for?

unshar extracts files from shell archives (shar files). It scans input looking for shell archive headers, then executes each archive through the shell to extract its contents. Shell archives are self-extracting scripts that contain files encoded as shell commands. They were historically used for distributing source code via email before modern archive formats became standard. When processing email messages, unshar automatically locates and extracts embedded shell archives, ignoring mail headers and signatures. Multiple archives can be concatenated and extracted with the -e option.

How do I run a basic unshar example?

Run `unshar [archive.shar]` in a terminal, then adjust file names, paths, flags, or remote targets for your system.

What does -d, --directory _dir_ do in unshar?

Change to directory before extracting.