Ask Ubuntu is a question and answer site for Ubuntu users and developers. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I want to know how to make these shar files, i mean to import files to this file and extract them. Could somebody explain me?

share|improve this question
Sorry for my bad english – Ciro Mar 8 at 18:46
oh no problem. At least you typed it in english ;-) I've seen japanese, russian and more :D – Rinzwind Mar 8 at 19:16
up vote 4 down vote accepted

shar is not installed by default and it is part of shar-utils. To install:

sudo apt-get install sharutils

The man page for shar has a good amount of information, warnings and examples. From the link:


Shar creates "shell archives" (or shar files) which are in text format and can be mailed. These files may be unpacked later by executing them with /bin/sh. The resulting archive is sent to standard out unless the -o option is given. A wide range of features provide extensive flexibility in manufacturing shars and in specifying shar "smartness". Archives may be "vanilla" or comprehensive.

and it has some examples:


shar *.c > cprog.shar          # all C prog sources
shar -Q *.[ch] > cprog.shar    # non-verbose, .c and .h files
shar -B -l28 *.arc    # all binary .arc files, into
                               # files thru
shar -f /lcl/src/u*.c >   # use only the filenames

Have a look though all the options at the man page for compression, integrity checks, internationalization and more.

It has a counterpart called unshar


Unshar scans mail messages looking for the start of a shell archive. It then passes the archive through a copy of the shell to unpack it. It will accept multiple files. If no files are given, standard input is used.

To extract the files in a shar archive:

$ sh example.shar

unshar is another way to extract files. This also handles .shar files that begin with email headers or other extraneous data.

$ unshar example.shar
share|improve this answer

You need to install sharutils

sudo apt-get install sharutils

Once installed, you can refer to its man file to know how to use it.

man shar

Basic syntax is:

shar <list of files>
share|improve this answer
And where do the created shar files go? – Ciro Mar 8 at 19:11
@ciro into a container like a tar or zip file would. You then put the .shar file into a mail and send it to someone. And that person can unshar it – Rinzwind Mar 8 at 19:13

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.