Linux / UNIX minicom Serial Communication Program

by Vivek Gite · 22 comments

Linux comes with many serial text and gui based serial communication programs. My favorite is minicom - friendly menu driven serial communication program.

If you are addicted to DOS / Windows TELIX (a telecommunications program originally written for DOS and was released in 1986), minicom is for you under Linux / UNIX.

minicom Common features / usage

=> Setting up a remote serial console
=> Access a computer / server if the LAN is down
=> Connect to embedded Linux / BSD device via null modem cable
=> Connect to Cisco routers for configuration
=> Connect to dump device i.e. device w/o keyboard and mouse
=> Dialing directory with auto-redial
=> Support for UUCP-style lock files on serial devices
=> Separate script language interpreter
=> Capture to file
=> Multiple users with individual configurations

Let us see how to configure minicom for my Soekris net4801 Single Board Computer / embedded Linux device.

Install minicom

Use apt-get under Debian / Ubuntu Linux, enter:
$ sudo apt-get install minicom
If you are using Red hat Linux (RHEL) / CentOS / Fedora Linux, enter:
# yum install minicom

How do I use minicom?

First, make sure Linux has detected serial ports. Use setserial command to set and/or report the configuration information associated with a serial port.

Setup minicom

The -s option use to setup minicom. Type the following command at shell prompt:
$ minicom -s
Configure the first time when you run minicom
(Fig. 01: minicom in configuration mode)
Some terminals such as the Linux console support color with the standard ANSI escape sequences. Type the following command start minicom with colours:
$ minicom -s -c on
Minicom in configuration mode with colour console
(Fig: 02: minicom in configuration mode with color console)
When minicom starts, it first searches the MINICOM environment variable for command-line arguments, which can be over-ridden on the command line. Thus, if you have done:
$ export MINICOM="-m -c on"
Start minicom
$ minicom
minicom will assume that your terminal has a Meta or key and that color is supported. You can add MINICOM variable to your shell startup script such as ~/.bash_profile.

minicom keyboard short cut keys

Use the following keys:

  1. UP arrow-up or k
  2. DOWN arrow-down or j
  3. LEFT arrow-left or h
  4. RIGHT arrow-right or l
  5. CHOOSE (select menu) Enter
  6. CANCEL ESCape

Configure serial port

You need to configure serial port. Use up and down arrows to select menus. Press down and select Serial port setup:
Minicom serial port configuration
(Fig. 03: Configure serial port with minicom)

  • Press A to setup serial device name such as /dev/ttyS1
  • Press E to setup Bps/Par/Bits
  • Press [ESC] to exit
  • Save setup as DFL
  • Exit

More on shortcut keys

To activate help menu press [CTRL+A] followed by [Z] for help on special keys:
minicom command summary
(Fig: 04: minicom command help summary)

minicom in action

You need to connect your serial device such as router or modem using modem cable. Once connected power on device and type minicom command without -s option:
$ minicom -c on
Minicom in action - connected to one of my dump device
(Fig: 05: minicom connected to one of my embedded Linux device via null modem cable [ click to enlarge image])
The soekris embedded Linux / BSD board with AMD 266 Mhz CPU + 256M RAM. This device connected to my computer using DB9 null modem cable. During the development you need to use minicom to install Linux kernel, format filesystem and configure device.

Featured Articles:

Want to read Linux tips and tricks, but don't have time to check our blog everyday? Subscribe to our daily email newsletter to make sure you don't miss a single tip/tricks. Subscribe to our weekly newsletter here!

{ 22 comments… read them below or add one }

1 Marco 02.05.08 at 9:27 am

Hi,
I use minicom to connect to Solaris host, recently I got some problems because minicom send somenthing on the wire that the host fell like a break signal going down to the obp(fortunatly didn’t happen on a production system). I already removed all the intitializtion strings…Any ideas?
Thanks
Cheers
M

2 gmo 02.12.08 at 10:12 am

Marco,
If you do “man minicom”, you’ll find lots of options. I would suggest starting minicom with -o.

As a side note, I recommend kermit over minicom, it’s way better, as long as you create your own .kermrc containing the options you usually use.

3 Dave Uhring 02.12.08 at 12:35 pm

Marco needs to edit /etc/default/kbd on his Solaris system to prevent such accidental breaks. Uncomment the line:

KEYBOARD_ABORT=alternate

4 Net savant 03.14.08 at 2:14 pm

I am using a health checkup machine, connected to my redhat linux 4 system with minicom 2.0.0,which sends data to serial port in a hexadecimal format only when it receives a command of 0×68 from the PC. i had tried using stty -F /dev/ttyS0 9600 -parenb cs8 -cstopb but while using cat not getting anything from the port. tried using echo “0×68″ > /dev/ttyS0 but in vain. I had tried minicom by configuring it to /dev/ttyS1 and also to /dev/ttyS0 but minicom is showing offline. i am unable to decide the serial port because i have only one serial port which is being used for mouse. to the same port i had connected the machine by unplugging the mouse. Please help me out.
Thanks in advance

5 panna 05.06.08 at 7:09 am

hi,
i want to use minicom for connection to my GSM modem so that it can send message to particular mobile..
can u tell me how shud i proceed for this…i only have idea for this.. i dnt know the details for that..

6 rahul singh 05.12.08 at 9:48 am

hello

Thank you for give the step how to configure serial communicatin on internet . my suggestion please make one website there we can find all the linux/unix help topic with theory and graphically which is not available in books.

Thank-you
rahul singh ( iiht meeerut ) faculty=N+,REDHAT LINUX

7 Diego 07.04.08 at 1:30 pm

Hello,

I am trying to log on to my Cisco 836, bought second-hand as training material for the CCNA, and I am having a few difficulties with it.
I was hoping more experienced folks could help me in troubleshooting the problem.

I installed minicom 2.2 on Vector Linux and configured it following the how=to above. When I run minicom =c on, it shows Initializing modem, then goes back to the main menu and asks to “Press CTRL-A Z for help on special keys”.

When I do press CTRL-A, it shows me as OFFLINE in the lower right corner. The same happens with both ttyS0 and ttyS1.

Now a bit background information: Vector Linux kindly starts the serial ports on startup, and a dmesg |grep ttyS reveals that both ttyS0 and ttyS1 are active.
The router itself is linked to the db25 port via a rolled cable and a RJ45 to DB25 adapter (all self made; I do not exclude that the problem is due to my poor wiring skills).

I have no way of telling whether the router itself is working correctly or not, but if I connect it to my Lan, I am able to see its IP address.

Any suggestion as to where the problem might lie would be very welcome.

Cheers,

Diego

8 arsene 08.07.08 at 8:17 pm

I am interested in learning kernel.

Currently I have successfully setup virtualbox using serial port (/dev/ttyS0) and minicom (`minicom -s /dev/ttyS0`) looks connect to /dev/ttyS0 as it shows

OPTIONS: I18n
Compiled on Jun 6 2008, 22:41:04.
Port /dev/ttyS0

Would you please to give me some advice or suggestion on how can I capture message sent to minicom (from virtualbox)? Or how can I send command / debug from minicom?

Thank you very much,

9 anon 08.15.08 at 11:17 pm

You are awesome, thank you for this information.

10 ganesh 11.11.08 at 8:21 am

I have a serial port(15 pin type) and i wanted to find the serial port (S0 or S1), so i tried the following
dmesg | grep ttyS but no warning or nothing comes up in the console, but i am taken to new prompt
$dmesg | grep ttyS
$
What should be done?

11 Danesh 11.14.08 at 1:22 am

I use it to connect to my storage devices.
Thanks

12 luis 12.11.08 at 5:29 pm

ttyS1: LSR safety check engaged!
ttyS1: LSR safety check engaged!
ttyS1: LSR safety check engaged!
ttyS1: LSR safety check engaged!
ttyS1: LSR safety check engaged!
ttyS1: LSR safety check engaged!

thats what i can see
minicom sucks
is there any other way ?

13 Hitesh Bumtariya 04.01.09 at 11:01 am

hi,
i want to use minicom for connection to my GSM modem so that it can send message to particular mobile..
can u tell me how shud i proceed for thisâ?¦i only have idea for this.. i dnt know the details for that..

14 arunprasad 04.02.09 at 9:49 am

hai,
i want send sms using gsm mobile using linux box.i need a C program to send the AT commands to gsm mobile.pls send me the details regrading

15 harshada 05.19.09 at 7:53 am

I want to configure port no 12 to minicom, but under dev folder I didn’t found ttyS12. But I found ttysc. So I configured port to /dev/ttysc. But after exiting setup, an error is thrown like “cannot open /dev/ttysc: Input/output error”. How to overcome this error.
Thanks in advance.

16 kuapao 07.16.09 at 11:29 pm

>Dave Uhring 02.12.08 at 12:35 pm
>
> Marco needs to edit /etc/default/kbd on his Solaris system to prevent such >accidental breaks. Uncomment the line:
>
> KEYBOARD_ABORT=alternate

This was most helpful, especially since I’m rusty in Solaris! Another file to check is /etc/system for the following line:
set abort_enable = 0

You want it set to 1 (default), if you want to be able to initiate a break or Stop-A.

17 karuna 08.08.09 at 12:10 pm

I am trying to connect router through linux but it is unsuccessful.
please suggest me what to do . I am using redhat linux 5.1

18 allen 08.12.09 at 1:44 am

I want to use minicom to connect with my embedded systerm,
‘dmesg |grep ttyS’ ,display ‘Xen virtual console successfully installed as ttyS0′
‘minicom -s /dev/ttyS0′,display ‘minicom: there is no global configuration file /etc/minirc._dev_ttyS0′
did u have the same problem?
thanks for help me out!

19 Dave 09.26.09 at 11:37 pm

Hi,

I use minicom on ubunto to connect via USB 2 serial device. When I type minicom -s and reach the Serial port setup I don’t find baud rate of 57600 to select from. Please advise.

Thanks,
David

20 Martin Paulus 09.29.09 at 6:23 pm

In a response to above questions: please realize that minicom does not set up your serial ports, this is the job of your operating system. Also picking a random tty-name is not the best way to get a connection up and running. I would suggest looking up a serial connection howto on tldp.org (if you’re running Linux), or find some other appropriate documentation.

p.s. if `dmesg|grep tty` ‘presents you’ with a new prompt this means that there were no results. check greps behaviour by creating a text file and then use `fgrep WORD FILE` or `cat FILE|grep WORD` to check for words you know appear and some you know do not appear in this text file. when in doubt, consult the manual, please

21 tobias 11.03.09 at 1:35 pm

pls read some manuals and willingly learn.. “i have trouble please help me very much” is NOT the correct way of asking people to spend their spare time helping you.

22 Saad Usmani 01.29.10 at 12:19 pm

Working perfectly fine. JAY Hoo…

Leave a Comment

You can use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>

Previous post:

Next post: