PySerial
PySerialDocs

Miniterm

Use PySerial Miniterm as a terminal emulator for serial ports. Quick reference for flags, key shortcuts, and filters.

PySerial ships with a built-in serial terminal. One command, no extra installs:

python -m serial.tools.miniterm /dev/ttyUSB0 115200

That opens /dev/ttyUSB0 at 115200 baud with 8N1 defaults. On Windows, replace the port with COM3 or whichever port your device is on.

Why Use Miniterm

Most developers reach for PuTTY or screen. Miniterm is already installed if you have PySerial, works on every OS, and supports filters and escape sequences that make debugging faster. No configuration files, no GUI.

Record serial sessions automatically

TofuPilot records test results from your PySerial scripts, tracks pass/fail rates, and generates compliance reports. Free to start.

Common Flags

FlagShortEffect
--echo-eEcho typed characters locally
--eolLine ending: CR, LF, or CRLF
--filter-fApply output filter (see below)
--rawNo CR/LF translation
--encodingCharacter encoding (default: UTF-8)
--parityN, E, O, M, S
--rtsctsEnable RTS/CTS flow control
--xonxoffEnable XON/XOFF flow control
--dtrSet initial DTR state: 0 or 1
--rtsSet initial RTS state: 0 or 1
--askPrompt for port and baud if not given
--quiet-qSuppress status messages

Line Ending Examples

Devices vary in what they expect. Arduino uses \r\n, many Linux devices use \n, some instruments use \r.

# CRLF for Arduino
python -m serial.tools.miniterm /dev/ttyUSB0 9600 --eol CRLF

# Local echo so you can see what you type
python -m serial.tools.miniterm /dev/ttyUSB0 9600 --echo

# Both
python -m serial.tools.miniterm /dev/ttyUSB0 9600 --eol CRLF --echo

Filters

Filters transform the displayed output. Apply them with --filter or toggle them at runtime.

FilterEffect
defaultStandard CR/LF handling
directNo translation at all
debugShow hex codes for non-printable characters
nocontrolStrip control characters
printableShow only printable characters
colorizeColor control characters

The debug filter is the most useful for diagnosing protocol issues. It shows bytes like \x0d and \x0a instead of silently consuming them.

python -m serial.tools.miniterm /dev/ttyUSB0 115200 --filter debug

Key Shortcuts

Miniterm uses Ctrl+T as a prefix key. Press Ctrl+T followed by one of these:

SequenceAction
Ctrl+T then Ctrl+TSend a literal Ctrl+T
Ctrl+T then Ctrl+HShow help (list all shortcuts)
Ctrl+T then Ctrl+QQuit miniterm
Ctrl+T then Ctrl+BSend break
Ctrl+T then Ctrl+DToggle DTR
Ctrl+T then Ctrl+RToggle RTS
Ctrl+T then Ctrl+PChange port settings
Ctrl+T then Ctrl+EToggle local echo
Ctrl+T then Ctrl+FToggle filter (cycles through filters)
Ctrl+T then Ctrl+LToggle EOL mode
Ctrl+T then Ctrl+IShow port info (baud, data bits, parity, stop bits)
Ctrl+T then Ctrl+UUpload a file (prompted for path)

To quit, press Ctrl+T then Ctrl+Q. Or just Ctrl+] (the default exit character).

Port Discovery

If you don't know which port to use, let miniterm list available ports:

python -m serial.tools.miniterm --ask

Or list ports separately:

python -m serial.tools.list_ports

This prints all detected serial ports with hardware descriptions, which helps you identify USB adapters.

Interactive Baud Rate Change

You can change baud rate at runtime. Press Ctrl+T then Ctrl+P and miniterm prompts you for new settings. This is useful when a device boots at one baud rate and switches to another after initialization.

Scripting with Miniterm Output

You can pipe miniterm output to a file for logging:

python -m serial.tools.miniterm /dev/ttyUSB0 115200 --quiet 2>/dev/null | tee serial_log.txt

The --quiet flag suppresses miniterm's status messages, and 2>/dev/null hides the startup banner. What remains is raw device output.

For more control over logging and data processing, write a Python script with PySerial directly. See Data Logging and Reading Data.

Common Use Cases

Quick device check. Plug in a USB-serial adapter and verify you can talk to it:

python -m serial.tools.miniterm /dev/ttyUSB0 9600 --echo --eol CRLF

Debug binary protocols. When you need to see raw bytes:

python -m serial.tools.miniterm /dev/ttyUSB0 115200 --filter debug --raw

SCPI instrument control. Send SCPI queries interactively. See SCPI over Serial for full details.

python -m serial.tools.miniterm /dev/ttyUSB0 9600 --eol LF

Then type *IDN? and press Enter.