Linux Minicom Serial Port

minicom is little command line based tool used to connect serial lines. In a more pragmatic definition minicom can be used to connect modems, routers and switch console ports via serial port. Minicom is very similar features and user interface to the TELIX.

How To: Use Minicom on Linux for Serial Port Comunication. By Jon on May 28th, 2010. If you need to connect your linux server to a cisco device through the serial port this is the best way to do it. This guide is for Debian/Ubuntu but will work with any linux distribution. Fix serial port permission denied errors on Linux April 8, 2013 Linux Jesin A 28 Comments The ancient serial port which is no longer found on the latest motherboards and even the not so latest laptops is still used for connecting to the console of networking devices, headless computers and a lot other applications.

  • Linux comes with many serial text and gui based serial communication programs. My favorite is minicom – friendly menu driven serial communication program. First, make sure Linux has detected serial ports. Use setserial command to set and/or report the configuration information associated with a.
  • Minicom is a simple terminal emulator useful to test quickly the FOX G20 serial ports. Minicom is installed by default on Debian microSD. To run it from the shell prompt just type.

We can install minicom with the following command for deb based distributions.

Install For Debian, Ubuntu, Kali, Mint

We can also install for rpm based distributions like below.

Using minicom in Linux to access serial devices. The audio track was recorded for the Linux in the HAM Shack podcast, and was added to the video later. An Arch Linux machine can be configured for connections via the serial console port, which enables administration of a machine even if it has no keyboard, mouse, monitor, or network attached to it. Installation of Arch Linux is possible via the serial console as well.

We generally use minicom with a physical port where it connects to a serial device like switch, router, pbx etc. Current PC configuration generally do not provides serial ports and prefer use USB devices. We can use USB to serial converter. We can list existing serial lines or USB converted serial lines simply named tty with the following command.

List tty Devices

We also learn from output that the tty device base baud rate is 115200 .

We can start minicom without any option or parameter but providing a serial device is better way. We will provide a USB-Serial convertor which is located at /dev/ttyUSB0 . We should provide the sudo command for root privileges.

After connecting minicom we may need to exit. But things work differently in minicom application. CTRL a is used for special key and other keys are used for different actions. We can exit like below.

Exit Minicom

We can get help with the CTRL a, z like below.

Windows 7 black edition download. Help Menu

We can list current serial line communication parameters like below.

List Current Serial Line Parameters

We can change serial line parameters while starting the minicom. We need to provide the required options and values. Some of the most used options are like below.

minicom provides easy way to setup serial line parameters in command line GUI. We can provide the -s option and enter

and enter to the Serial port setup menu like below.

Setup Mode

minicom: friendly serial communication program

Read minicom man page on Linux: $ man 1 minicom

NAME

minicom - friendly serial communication program

SYNOPSIS

minicom[options] [configuration]

DESCRIPTION

minicomis a communication program which somewhat resembles the sharewareprogram TELIX but is free with source code and runs under most Unices.Features include dialing directory with auto-redial, support forUUCP-style lock files on serial devices, a separate script languageinterpreter, capture to file, multiple users with individualconfigurations, and more.

COMMAND-LINE

-M, --metakey8
Same as -m, but assumes that your Meta key sets the 8th bit of thecharacter high (sends 128 + character code).
-z, --statline
Use terminal status line. This only works on terminals that support itand that have the relevant information in their termcap orterminfo database entry.
-l, --ansi
Literaltranslation of characters with the high bit set. With this flag on,minicom will try to translate the IBM line characters to ASCII. Many PC-unixclones will display character correctly without translation (Linux in aspecial mode, Coherent and SCO).
-L, --iso
Ditto but assume screen uses an ISO8859 character set.
-w, --wrap
Turns line-wrap on at startup by default.
-H, --displayhex
Turn on output in hex mode.
-a, --attrib=on/off
Attributeusage. Some terminals, notably Televideo's, have rotten attributehandling (serial instead of parallel). By default, minicom uses '-aon', but if you are using such a terminal you can (must!) supply theoption '-a off'. The trailing 'on' or 'off' is needed.
-t, --term=TERM
Terminaltype. With this flag, you can override the environment TERM variable.This is handy for use in the MINICOM environment variable; one can createa special termcap entry for use with minicom on the console, thatinitializes the screen to raw mode so that in conjunction with the -lflag, the IBM line characters are displayed untranslated.
-c, --color=on/off
Colorusage. Some terminals (such as the Linux console) support color withthe standard ANSI escape sequences. Because there is apparently notermcap support for color, these escape sequences are hard-coded intominicom. Therefore this option is off by default. You can turn it onwith '-c on'. This, and the '-m' option, are good candidates to putinto the MINICOM environment variable.
-S, --script=SCRIPT
script.Run the named script at startup. So far, passing username and passwordto a startup script is not supported. If you also use the -d option tostart dialing at startup, the -S script will be run BEFORE dialing theentries specified with -d.
-d, --dial=ENTRY
Dialan entry from the dialing directory on startup. You can specify anindex number, but also a substring of the name of the entry. If you specify a name that has multiple entries in the directory, they are alltagged for dialing. You can also specify multiple names or index numbersby separating them with commas. The dialing will start from the first entry specified after all other program initialization procedures are completed.
-p, --ptty=TTYP
Pseudoterminalto use. This overrides the terminal port defined in the configurationfiles, but only if it is a pseudo TTY. The filename supplied must be ofthe form (/dev/)tty[p-z/][0-f], (/dev/)pts[p-z/][0-f] or (/dev/)pty[p-z/][0-f]. For example, /dev/ttyp1, pts/0 or /dev/ptyp2.
-C, --capturefile=FILE
filename.Open capture file at startup.
-T, --disabletime
Disable the display of the online time in the status bar.
-b, --baudrate
Specify the baud rate, overriding the value given in the configurationfile.
-D, --device
Specify the device, overriding the value given in the configuration file.
-R, --remotecharset
Specify the character set of the remote system is using and convert it tothe character set of the local side. Example might be 'latin1'.
-7, --7bit
7bit mode for terminals which aren't 8bit capable. 8bit is default if theenvironment is configured for this via LANG or LC_ALL, 7bit otherwise.
-8, --8bit
8bit characters pass through without any modification. 'Continuous'means no locate/attribute control sequences are inserted withoutreal change of locate/attribute. This mode is to display 8bitmulti-byte characters such as Japanese. Not needed in every language with8bit characters. (For example displaying Finnish text doesn't need this.)
-h, --help
Display help and exit.
-v, --version
Print the minicom version.
Whenminicomstarts, it first searches the MINICOM environment variable forcommand-line arguments, which can be over-ridden on the command line.Thus, if you have doneMINICOM='-m -c on'

export MINICOM

or the equivalent, and start minicom, minicom will assume that yourterminalhas a Meta or <ALT> key and that color is supported. If you then log infrom a terminal without color support, and you have set MINICOM in yourstartup (.profile or equivalent) file, and don't want to re-set yourenvironment variable, you can type 'minicom -c off' and run withoutcolor support for that session.
configuration'. So it is possible to create multipleconfiguration files, for different ports, different users etc. Mostsensible is to use device names, such as tty1, tty64, sio2 etc. If auser creates his own configuration file, it will show up in his homedirectory as '.minirc.dfl' or '.minirc.configuration'.

USE

Minicom is window based. To pop-up a window with the function youwant, press Control-A (from now on, we will use C-A to meanControl-A), and then the function key (a-z or A-Z). By pressing C-Afirst and then 'z', a help screen comes up with a short summary of allcommands. This escape key can be altered when minicom is configured(-s option or C-A O), but we'll stick to Control-A for now.

For every menu the next keys can be used:

DOWN
arrow-down or 'j'
LEFT
arrow-left or 'h'
RIGHT
arrow-right or 'l'
CHOOSE
Enter
CANCEL
ESCape.

The screen is divided into two portions: the upper 24 lines are theterminal-emulator screen. In this window, ANSI or VT100 escapesequences are interpreted. If there is a line left at thebottom, a status line is placed there. If this is not possible thestatus line will be showed every time you press C-A. On terminalsthat have a special status line that will be used if the termcapinformation is complete and the -k flag has been given.

Possible commands are listed next, in alphabetical order.

A
Toggle 'Add Linefeed' on/off. If it is on, a linefeed is added beforeevery carriage return displayed on the screen.
B
Gives you a scroll back buffer. You can scroll up with u, down withd, a page up with b, a page down with f, and if you have themthe arrow and page up/page down keys can also be used. You can search for text in the buffer with s (case-sensitive) or S (case-insensitive). N will find the next occurrence of the string.c will enter citation mode. A text cursor appears and youspecify the start line by hitting Enter key. Then scroll back mode willfinish and the contents with prefix '>' will be sent.
C
Clears the screen.
D
Dial a number, or go to the dialing directory.
E
Toggle local echo on and off (if your version of minicom supports it).
F
A break signal is sent to the modem.
G
Run script (Go). Runs a login script.
H
Hangup.
I
Toggle the type of escape sequence that the cursor keys send betweennormal and applications mode. (See also the comment about the statusline below).
J
Jump to a shell. On return, the whole screen will be redrawn.
K
Clears the screen, runs kermit and redraws the screen upon return.
L
Turn Capture file on off. If turned on, all output sent to the screenwill be captured in the file too.
M
Sends the modem initialization string. If you are online and the DCD linesetting is on, you are asked for confirmation before the modem is initialized.
N
Toggle between three states, whether each line is prefixed with current dateand time, a timestamp is added every second, or no timestamps.
O
Configure minicom. Puts you in the configuration menu.
P
Communication Parameters. Allows you to change the bps rate, parity andnumber of bits.
Q
Exit minicom without resetting the modem. If macros changed and were notsaved, you will have a chance to do so.
R
Receive files. Choose from various protocols (external). If you have thefilename selection window and the prompt for download directory enabled,you'll get a selection window for choosing the directory fordownloading. Otherwise the download directory defined in the Filenames andpaths menu will be used.
S
Send files. Choose the protocol like you do with the receive command. Ifyou don't have the filename selection window enabled (in the File transferprotocols menu), you'll just have to write the filename(s) in a dialogwindow. If you have the selection window enabled, a window will pop upshowing the filenames in your upload directory. You can tag and untagfilenames by pressing spacebar, and move the cursor up and down with thecursor keys or j/k. The selected filenames are shown highlighted. Directorynames are shown [within brackets] and you can move up or down in thedirectory tree by pressing the spacebar twice. Finally, send the files bypressing ENTER or quit by pressing ESC.
T
Choose Terminal emulation: Ansi(color) or vt100.You can also change the backspace key here, turn the status line on or off, and define delay (in milliseconds) after each newline if you need that.
W
Toggle line-wrap on/off.
X
Exit minicom, reset modem. If macros changed and were not saved, you will have a chance to do so.
Y
Paste a file. Reads a file and sends its contests just as if it would betyped in.
Z
Pop up the help screen.

DIALING DIRECTORY

By pressing C-A D the program puts you in the dialing directory. Select acommand by pressing the capitalized letter or moving cursor right/left withthe arrow keys or the h/l keys and pressing Enter. You can add, delete oredit entries and move them up and down in the directory list. By choosing'dial' the phone numbers of the tagged entries, or if nothing is tagged,the number of the highlighted entry will be dialed. While the modem isdialing, you can press escape to cancel dialing. Any other key will closethe dial window, but won't cancel the dialing itself. Your dialingdirectory will be saved into the file '.dialdir' in your home directory.You can scroll up and down with the arrow keys, but you can also scrollcomplete pages by pressing the PageUp or PageDown key. If you don't havethose, use Control-B (Backward) and Control-F (Forward). You can use thespace bar to tag a number of entries and minicom will rotate troughthis list if a connection can't be made. A '>' symbol is drawn in thedirectory before the names of the tagged entries.

The 'edit' menu speaks for itself, but I will discuss it briefly here.

G - Password
The password is passed as '$PASS'.
H - Terminal Emulation
Use ANSI or VT100 emulation.
I - Backspace key sends
What code (Backspace or Delete) the backspace key sends.
J - Linewrap
Can be on or off.
K - Line settings
Bps rate, bits, parity and number of stop bits to use for this connection. You can choose current for the speed, so that it will use whatever speed is being used at that moment (useful if you have multiple modems).
L - Conversion table
You may specify a character conversion table to be loaded whenever thisentry answers, before running the login script. If this field is blank, the conversion table stays unchanged.

The edit menu also shows the latest date and time when you called thisentry and the total number of calls there, but doesn't let you change them.They are updated automatically when you connect.

The moVe command lets you move the highlighted entry up or down in thedialing directory with the up/down arrow keys or the k and j keys. PressEnter or ESC to end moving the entry.

CONFIGURATION

By pressing C-A O you will be thrown into the setup menu.

Filenames and paths

A - Download directory
where the downloaded files go to.
B - Upload directory
where the uploaded files are read from.
C - Script directory
Where you keep your login scripts.
D - Script program
Which program to use as the script interpreter. Defaults to theprogram 'runscript', but if you want to use something else (eg,/bin/sh or 'expect') it is possible. Stdin and stdout are connectedto the modem, stderr to the screen.
E - Kermit program
Where to find the executable for kermit, and it's options. Some simplemacro's can be used on the command line: '%l' is expanded to thecomplete filename of the dial out-device, '%f' is expanded to the serialport file descriptor and '%b' is expanded to the current serial port speed.
F - Logging options
Options to configure the logfile writing.
A - File name
Here you can enter the name of the logfile. The file will be written inyour home directory, and the default value is 'minicom.log'. If you blank the name, all logging is turned off.
B - Log connects and hangups
This option defines whether or not the logfile is written when the remoteend answers the call or hangs up. Or when you give the hangup commandyourself or leave minicom without hangup while online.
C - Log file transfers
Do you want log entries of receiving and sending files.
The 'log' command in the scripts is not affected by logging options B and C.It is always executed, if you just have the name of the log file defined.

File Transfer Protocols

Serial port setup


If you have modems connected to two or more serial ports, you may specifyall of them here in a list separated by space, comma or semicolon. WhenMinicom starts, it checks the list until it finds an available modem and uses that one. (However, you can't specify different init strings to them.. at least not yet.)
To use a UNIX socket for communication the device name must be prefixedwith 'unix#' following by the full path and the filename of the socket.Minicom will then try to connect to this socket as a client. As long as itcannot connect to the socket it stays 'offline'. As soon as the connectionestablishes, minicom goes 'online'. If the server closes the socket, minicomswitches to 'offline' again.
B - Lock file location
On most systems This should be /usr/spool/uucp. GNU/Linux systems use/var/lock. If this directory does not exist,minicom will not attempt to use lockfiles.
C - Callin program
If you have a uugetty or something on your serial port, it could bethat you want a program to be run to switch the modem cq. port intodialin/dialout mode. This is the program to get into dialin mode.
D - Callout program
And this to get into dialout mode.
E - Bps/Par/Bits
Default parameters at startup.

Minicom Linux Serial Port Cisco

If one of the entries is left blank, it will not be used. So if youdon't care about locking, and don't have a getty running on yourmodemline, entries B - D should be left blank.

Modem and Dialing

R - Modem has DCD line
If your modem, and your O/S both support the DCD line (that goes 'high'when a connection is made) minicom will use it. When you have this optionon, minicom will also NOT start dialing while you are already online.
S - Status line shows DTE speed / line speed
You can toggle the status line to show either the DTE speed (the speed which minicom uses to communicate with your modem) or the line speed(the speed that your modem uses on the line to communicate with the other modem). Notice that the line speed may change during the connection,but you will still only see the initial speed that the modems startedthe connection with. This is because the modem doesn't tell the programif the speed is changed. Also, to see the line speed, you need to havethe modem set to show it in the connect string. Otherwise you will only see 0 as the line speed.
T - Multi-line untag
You can toggle the feature to untag entries from the dialing directory whena connection is established to a multi-line BBS. All the tagged entries thathave the same name are untagged.
B - Backspace key sends
There still are some systems that want a VT100 to send DEL instead ofBS. With this option you can enable that stupidity. (Eh, it's even onby default..)
C - Status line is
Enabled or disabled. Some slow terminals (for example, X-terminals)cause the status line to jump 'up and down' when scrolling, so you canturn it off if desired. It will still be shown in command-mode.
D - Alarm sound
If turned on, minicom will sound an alarm (on the console only) aftera successful connection and when up/downloading is complete.
E - Foreground Color (menu)
indicates the foreground color to use for all the configuration windows in minicom.
F - Background Color (menu)
indicates the background color to use for all the configuration windows in minicom. Note that minicom will not allow you to set foreground and background colors to the same value.
G - Foreground Color (term)
indicates the foreground color to use in the terminal window.
H - Background Color (term)
indicates the background color to use in the terminal window. Note that minicom will not allow you to set foreground and background colors to the same value.
I - Foreground Color (stat)
indicates the foreground color to use in for the status bar.
J - Background Color (stat)
indicates the color to use in for thestatus bar. Note that minicom will allow you to set the status bar'sforeground and background colors to the same value. This will effectivelymake the status bar invisible but if these are your intentions, pleasesee the option
K - History buffer size
The number of lines to keep in the history buffer (for backscrolling).
L - Macros file
is the full path to the file that holdsmacros. Macros allow you to define a string to be sent when you pressa certain key. In minicom, you may define F1 through F10 to sendup to 256 characters [this is set at compile time]. The filename youspecify is verified as soon as you hit ENTER. If you do not have permissionsto create the specified file, an error message will so indicate and youwill be forced to re-edit the filename. If you are permitted to createthe file, minicom checks to see if it already exists. If so, it assumesit's a macro file and reads it in. If it isn't, well, it's your problem :-)If the file does not exist, the filename is accepted.
M - Edit Macros
opens up a new window which allows you to edit the F1 through F10 macros.
N - Macros enabled
- Yes or No. If macros are disabled, the F1-F10keys will just send the VT100/VT220 function key escape sequences.
O - Character conversion
The active conversion table filename is shown here. If you can see noname, no conversion is active. Pressing O, you will see the conversion table edit menu.
Edit Macros
Here, the macros for F1 through F10 are defined. The bottom of thewindow shows a legend of character combinations that have special meaning.They allow you to enter special control characters with plain text byprefixing them with a '^', in which '^^' means '^' itself. You cansend a 1 second delay with the '^~' code. This is useful when you aretrying to login after ftp'ing or telnet'ing somewhere. You can also include your current username and password from the phone directory in the macros with 'u' and 'p', respectively. If you needthe backslash character in the macro, write it doubled as '.To edit a macro, press the number (or letter for F10) and you will be moved to the end of the macro. When editing the line, you may use the left & right arrows, Home & End keys, Delete & BackSpace, and ESC and RETURN. ESC cancels any changes made while ENTER accepts the changes.
Character conversion
Here you can edit the character conversion table. If you are not anAmerican, you know that in many languages there are characters that arenot included in the ASCII character set, and in the old times they mayhave replaced some less important characters in ASCII and now they areoften represented with character codes above 127. AND there are variousdifferent ways to represent them. This is where you may edit conversiontables for systems that use a character set different from the one on yourcomputer.
A - Load table
You probably guessed it. This command loads a table from the disk.You are asked a file name for the table.Predefined tables .mciso, .mcpc8 and .mcsf7 should be included with theprogram. Table .mciso does no conversion, .mcpc8 is to be used for connections with systems that use the 8-bit pc character set, and .mcsf7is for compatibility with the systems that uses the good old 7-bit codingto replace the characters { }[] with the diacritical characters used inFinnish and Swedish.
B - Save table
This one saves the active table on the filename you specify.
C - edit char
This is where you can make your own modifications to the existing table.First you are asked the character value (in decimal) whose conversion youwant to change. Next you'll say which character you want to see on your screen when that character comes from the outside world. And then you'llbe asked what you want to be sent out when you enter that character fromyour keyboard.
D - next screen
E - prev screen
Yeah, you probably noticed that this screen shows you what kind ofconversions are active. The screen just is (usually) too small to showthe whole table at once in an easy-to-understand format. This is how you canscroll the table left and right.
F - convert capture
Toggles whether or not the character conversion table is used whenwriting the capture file.

STATUS LINE

The status line has several indicators, that speak for themselves.The mysterious APP or NOR indicator probably needs explanation. TheVT100 cursor keys can be in two modes: applications mode and cursormode. This is controlled by an escape sequence. If you find thatthe cursor keys do not work in, say, vi when you're logged in usingminicom then you can see with this indicator whether the cursor keysare in applications or cursor mode. You can toggle the two with theC-A I key. If the cursor keys then work, it's probably an error inthe remote system's termcap initialization strings (is).

LOCALES

Minicom has support for local languages. This means you can change mostof the English messages and other strings to another language by settingthe environment variable LANG.

Linux Minicom Com Port

MISC

If minicom is hung, kill it with SIGTERM . (This means kill -15, orsince sigterm is default, just plain 'kill <minicompid>'. This willcause a graceful exit of minicom, doing resets and everything.You may kill minicom from a script with the command '! killall -9 minicom'without hanging up the line. Without the -9 parameter, minicom first hangs up before exiting.

Since a lot of escape sequences begin with ESC (Arrow up is ESC [ A),Minicom does not know if the escape character it gets is you pressingthe escape key, or part of a sequence.

An old version of Minicom, V1.2, solved this in a rather crude way:to get the escape key, you had to press it twice.

As of release 1.3 this has bettered a little: now a 1-second timeoutis builtin, like in vi. For systems that have the select() system callthe timeout is 0.5 seconds. And.. surprise: a special Linux-dependenthack :-) was added. Now, minicom can separate the escape key andescape-sequences. To see how dirty this was done, look into wkeys.c.But it works like a charm!

FILES

Minicom keeps it's configuration files in one directory, usually/var/lib/minicom, /usr/local/etc or /etc. To find out what defaultdirectory minicom has compiled in, issue the command minicom -h.You'll probably also find the demo files for runscript(1),and the examples of character conversion tables either there or in the subdirectories of /usr/doc/minicom*. The conversion tables arenamed something like mc.* in that directory, but you probably want tocopy the ones you need in your home directory as something beginningwith a dot.

SEE ALSO

runscript(1)

BUGS

Please report any bugs tominicom-devel [at] lists.alioth.debian.org

Linux Minicom Serial Portable

.Thank you!

AUTHORS

The original author of minicom is Miquel van Smoorenburg (miquels [at] cistron.nl).He wrote versions up to 1.75.
Jukka Lahtinen (walker [at] netsonic.fi, jukkal [at] despammed.com) has been responsiblefor new versions since 1.78, helped by some other people, including:
filipg [at] paranoia.com wrote the History buffer searching to 1.79.

Linux Minicom Serial Port Adapter


Arnaldo Carvalho de Melo (acme [at] conectiva.com.br) did the internationalization and the Brazilian Portuguese translations.
Jim Seymour (jseymour [at] jimsun.LinxNet.com) wrote the multiple modem support and the filename selection window used since 1.80.

Linux Minicom Connect To Serial Port

Tomohiro Kubota (kubota [at] debian.or.jp) wrote the Japanese translations and the citation facility, and did some fixes.
Gael Queri (gqueri [at] mail.dotcom.fr) wrote the French translations.
Arkadiusz Miskiewicz (misiek [at] pld.org.pl) wrote the Polish translations.
Kim Soyoung (nexti [at] chollian.net) wrote the Korean translations.
Jork Loeser (jork.loeser [at] inf.tu-dresden.de) provided the socket extension.

Most of this man page is copied, with corrections, from the original minicomREADME, but some pieces and the corrections are by Michael K. Johnson.

Jukka Lahtinen (walker [at] netsonic.fi) has added some information of the changes made after version 1.75.

Linux man pages generated by: SysTutorials
Linux Man Pages Copyright Respective Owners. Site Copyright © SysTutorials. All Rights Reserved.