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?

  • Sorry for my bad english – Ciro Mar 8 '16 at 18:46
  • oh no problem. At least you typed it in english ;-) I've seen japanese, russian and more :D – Rinzwind Mar 8 '16 at 19:16

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 -oarc.sh *.arc    # all binary .arc files, into
                               # files arc.sh.01 thru arc.sh.NN
shar -f /lcl/src/u*.c > u.sh   # 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

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>
  • And where do the created shar files go? – Ciro Mar 8 '16 at 19:11
  • 1
    @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 '16 at 19:13

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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