Linux / UNIX minicom Serial Communication Program

by on February 5, 2008 · 39 comments· LAST UPDATED February 5, 2008

in , ,

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.

TwitterFacebookGoogle+PDF versionFound an error/typo on this page? Help us!

{ 39 comments… read them below or add one }

1 Marco February 5, 2008 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

Reply

2 gmo February 12, 2008 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.

Reply

3 Doudou August 3, 2010 at 5:39 pm

hi,

I want to ask you the relationship between comgt and minicom. When i execute the command comgt, why I can find the information in the minicom window ?

Thanks.

Reply

4 Dave Uhring February 12, 2008 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

Reply

5 Net savant March 14, 2008 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

Reply

6 panna May 6, 2008 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..

Reply

7 rahul singh May 12, 2008 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

Reply

8 Diego July 4, 2008 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

Reply

9 arsene August 7, 2008 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,

Reply

10 anon August 15, 2008 at 11:17 pm

You are awesome, thank you for this information.

Reply

11 ganesh November 11, 2008 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?

Reply

12 Danesh November 14, 2008 at 1:22 am

I use it to connect to my storage devices.
Thanks

Reply

13 luis December 11, 2008 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 ?

Reply

14 Hitesh Bumtariya April 1, 2009 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..

Reply

15 arunprasad April 2, 2009 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

Reply

16 harshada May 19, 2009 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.

Reply

17 kuapao July 16, 2009 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.

Reply

18 karuna August 8, 2009 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

Reply

19 allen August 12, 2009 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!

Reply

20 Dave September 26, 2009 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

Reply

21 Martin Paulus September 29, 2009 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

Reply

22 tobias November 3, 2009 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.

Reply

23 Saad Usmani January 29, 2010 at 12:19 pm

Working perfectly fine. JAY Hoo…

Reply

24 szmarcek March 28, 2010 at 1:01 am

My router is linked to the db25 port via a rolled cable and a RJ45 to DB25 adapter and minicom did not work with /dev/ttyS0 or S1 and dmesg with grep ttyS* did not show anything but I noticed /dev/ttyUSB0 entry under /dev/ and when I set minicom to point to /dev/ttyUSB0 everyhting worked fine!

Reply

25 PAgore May 19, 2010 at 7:20 pm

Kewl!
Now i can use my grasshopper (ICnova AP7000 Base) in a colorful terminal! :D
$ minicom -c on

Thank You! :)

Reply

26 gtr November 15, 2010 at 9:25 am

Thank you for sharing this information.
I like to know if we can use minicom to run in different config to different serial ports in one linux box? I have no problem in using minicom to /dev/ttyS0 (build-in). I add 2 more serial (PCI) and detected it as /dev/ttyS1 and /dev/ttyS2. Problem is when I use this 2 serial ports it says “offline”. cables are ok and devices connected to are all active. check it using /dev/ttyS0. Can anyone help me? TIA

Reply

27 mr.thinh March 14, 2011 at 6:37 pm

dear . . .

I have ttyS0 , ttyS1, ttyS2 . I can see one of them only . How can i connect and use 3 of them at the same time ?

Thank you .

Reply

28 dustin March 1, 2011 at 9:02 pm

Thanks – the quick tutorial helped a lot

Reply

29 robert April 17, 2011 at 4:48 pm

I have done of the minicom set up, but when it comes to saving the file it states that i dont have the permissions to save the file as dft. Im not sure if i have to be in root to save the file. Currently using Kubuntu 10.10 at the moment. Trying to set up a Cisco Router.

Reply

30 robert April 17, 2011 at 5:26 pm

Update… i have sorted it…. pressed enter and router>

Reply

31 robert April 17, 2011 at 5:37 pm

I think the issue with the saving of the file is still there, but i think that might be down to not being able to get into root to save the file

Reply

32 rajeev September 24, 2011 at 12:24 pm

Hi all,
I had installed minicom in my Linux PC with “Linux localhost.localdomain 2.6.23.1-42.fc8 #1 SMP Tue Oct 30 13:55:12 EDT 2007 i686 i686 i386 GNU/Linux” installed. when i run minicom i can watch my unit booting
Welcome to minicom 2.2

OPTIONS: I18n
Compiled on Sep 25 2007, 06:13:56.
Port /dev/ttyS0

Press CTRL-A Z for help on special keys

RomBOOT
>Start AT91Bootstrap…

U-Boot 2008.10 (Sep 19 2011 – 17:57:15)

DRAM: 64 MB
Initializing Display
NAND: 256 MiB
DataFlash:AT45DB642
Nb pages: 8192
Page Size: 1056
Size= 8650752 bytes
Logical address: 0xD0000000
Area 0: D0000000 to D00041FF (RO) Bootstrap
Area 1: D0004200 to D00083FF Environment
Area 2: D0008400 to D0041FFF (RO) U-Boot
Area 3: D0042000 to D0251FFF Kernel
Area 4: D0252000 to D083FFFF FS
*** Warning – bad CRC, using defaul

but when i try to type from keyboard i am unable to communicate to minicom
Distribution built by Analogics Tech Ind Limited,Hyderabad
Kernel 2.6.28-ATIL-H10 for armv5tejl
ATIL-H10 login:
i am unable to type a thing on minicom
pls help..
Regards,
Rajeev

Reply

33 prince May 29, 2014 at 11:02 am

Make the setup..
Hardware flow control : NO
software flow control: NO

Reply

34 parag dhake January 13, 2012 at 12:02 pm

hello friends,
we are doing a project on pci driver.
our project is write pci driver and use functionality of ARM7 through uart.
i am done with pci driver, now i want to check our driver for full fledge.
i have a problem, when i am starting comunication between two pc using db9 connectors, who will first start the communication get full data & another side some data gets lost may be starting data.
plz tell me that how i will minimizes this problem?
what will i do in driver?
i am use platform “linux”………….
Rgards
parag
dhakeparag81@gmail.com

Reply

35 Swathi April 17, 2012 at 9:50 pm

Hello,
When I tried to configure my minicom using minicom -s, it is displaying dev/modem instead of dev/ttyS0. What does this mean? I need to connect my Embedded Linux board (ARM processor) to one of the ports. Hence I need to configure minicom correctly before doing that. Any help is appreciated.

Thank you

Reply

36 yannick June 15, 2012 at 9:52 am

I use minicom for modem with smslib. But when i connect, i cannot write the AT’s commands. My linux terminal don’t show me the command AT that i write. Can somedy help me please.

Thank you

Reply

37 Greg Ennis September 6, 2012 at 8:43 pm

I am trying to use minicom within a bash script to logon to a remote computer, poll it to see if files for downloading are present, and then download the files and process them accordingly. Can minicom be used without user interaction? Is there a tutorial present pertaining the script language that minicom supports? Thanks much, Greg Ennis

Reply

38 passing by January 14, 2013 at 5:40 pm

Don’t bother with minicom unless you need modem functions. Otherwise, you can probably do what you like with a package called “expect” – using the “autoexpect” script. This is a TCL script that allows you to simply type your responses and then gives you an editable script. When combined with bash, you can do a lot.
Also, have a look at curl and wget.

Reply

39 arvid May 22, 2013 at 11:04 am

Hi everyone,

I’m not getting any output from minicom.. I’ve tried shorting pins 2 and 3 without result, and also checked every pin with o-scope while typing or sending files – no response – just a constant +5V. I’m using a prolific USB-to-serial adapter on OS X. I have no problems with input, so I’m pretty sure I’m on the right serial device, just no output..
I’ve also tried all possible combinations of hardware/software flow control without any luck.

Any suggestions much appreciated!

Arvid

Reply

Leave a Comment

Tagged as: , , , , , , , , , , , , , , , , ,

Previous post:

Next post: