Doctor Bob
Linux Topic
Search

 
TOURBUS
HOME PAGE
SAVVY
CONSUMER
FREE TECH
SUPPORT

COMPRESSION, ENCODING AND ENCRYPTION

What is a Shell Archive?

Shell Archives

A shell archive is like a tar file, but it is used only for packaging source code and other plain-text files. It provides a convenient way to smash together all the source files for a project into one file that can be distributed by email. (The original files are not deleted.)
Shell archives (commonly called shar--for shell archive--files) get their name from the fact that they contain the Linux commands needed to extract the original files.

By convention, shell archives are named with a .shar extension. To create a shar file, use a command like this:

shar input_files > shar_file

So, to create a panda.shar file containing all the files from the panda/source directory, you'd issue a command like this (note the use of the asterisk as a wildcard):

shar panda/source/* > panda.shar

If you look inside a shar file, you'll see the original files sandwiched between the commands to extract them. But you don't have to execute those commands directly to unpack a shar file. Just enter this command to extract the files to the current directory:

sh panda.shar

The sh command will run the Linux commands embedded in the panda.shar file and re-create all the original files.

You might be wondering why you'd want to use shar files when tar files seem to serve the same purpose. The answer is that shar files are ready to send (because they're plain text), whereas a tar file must be encoded first. See the next section for more on encoding and decoding.

[ RETURN TO INDEX ]




Ask Bob Rankin - Free Tech Support
<Send This Link to a Friend>         <Help>         <Bookmark This Page>


Copyright © by Bob Rankin
All rights reserved - Redistribution is allowed only with permission.