Sending binary files via minicom

Minicom is the defacto standard serial communication program for Linux, modeled after the old DOS program Telix.  While Minicom isn’t as advanced as Telix, it does offer quite a bit of functionality that satisfies most common needs.  Unfortunately, it doesn’t include a binary upload option.

While not commonly used, once in a while, you just need it.  Fortunately, Minicom does allow you to define your own file transfer utilities.  So here’s a simple little script you can use that will give you a “binary upload” option in Minicom.  To make things a little prettier, I used a little utility called ‘pv’ so that you can get a progress bar while it transfers your file.

If you don’t already have it, you should be able to find it easily within your Linux distribution:

On RPM-based systems, just type:

sudo yum install pv

On Debian-based systems, type:

sudo apt-get install pv

Now create this script, and place it in your ~/bin/ directory as (for example) bin-xfr.


while [ $# -gt 0 ]; do
 case "$1" in
 echo "$0 -i infile -o outfile"
cat << EOF
binary-xfer utility for minicom
Sending file ${INFILE} to ${OUTFILE}

/usr/bin/pv --force -i 0.25 -B 128  ${INFILE}  2>&1 > ${OUTFILE}
# Use the line below if you don't have pv!

# /bin/cat ${INFILE} > ${OUTFILE}
cat << EOF

File transfer complete
sleep 1

Now go over to minicom and go to the configuration menu (via ESC-O), then “File transfer protocols”. You can add a section there called “binary”, point it at your file, and specify:

  • Name: Binary
  • Program: /home/MYUSERNAME/bin/bin-xfer -o %l
  • Name: Y
  • U/D:  U
  • FullScr: Y
  • IO-Red: N
  • Multi:N

Then leave the menu and save your options.  Next time you send a file (via ESC-S), you should see “Binary” listed as an option.


4 thoughts on “Sending binary files via minicom

  1. Seventeen years Almost legal I still remember back in the day, loadnig an early RedHat distro on an 8086. I never got the reputation, but it seems OSS keeps following me. Introducing the idea of commodity hardware’ to an SGI/Solaris shop was an interesting evolution. Though watching the last of the brightly colored cases leave the server room was a little painful. It’s interesting to see the evolution once you can make a business case for transition. Though it is kind of sad when one of the engineers starts schooling the IT department.

  2. Much simpler to just add a line to minicom config -> File transfer protocols

    * Name: raw-upload
    * Program: /bin/cat
    * Name: Y
    * U/D: U
    * FullScr: N
    * IO-Red.: Y
    * Multi: N

  3. Unfortunately I can’t get this to work either…

    I have connected an oscilloscope to the TX pin and GND on my USB to RS232 adapter and I couldn’t see any data here when the binary protocol is used. If I used ASCII transfer instead data appeared on the oscilloscope…

Leave a Reply

Your email address will not be published. Required fields are marked *