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 115200That 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
| Flag | Short | Effect |
|---|---|---|
--echo | -e | Echo typed characters locally |
--eol | Line ending: CR, LF, or CRLF | |
--filter | -f | Apply output filter (see below) |
--raw | No CR/LF translation | |
--encoding | Character encoding (default: UTF-8) | |
--parity | N, E, O, M, S | |
--rtscts | Enable RTS/CTS flow control | |
--xonxoff | Enable XON/XOFF flow control | |
--dtr | Set initial DTR state: 0 or 1 | |
--rts | Set initial RTS state: 0 or 1 | |
--ask | Prompt for port and baud if not given | |
--quiet | -q | Suppress 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 --echoFilters
Filters transform the displayed output. Apply them with --filter or toggle them at runtime.
| Filter | Effect |
|---|---|
default | Standard CR/LF handling |
direct | No translation at all |
debug | Show hex codes for non-printable characters |
nocontrol | Strip control characters |
printable | Show only printable characters |
colorize | Color 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 debugKey Shortcuts
Miniterm uses Ctrl+T as a prefix key. Press Ctrl+T followed by one of these:
| Sequence | Action |
|---|---|
Ctrl+T then Ctrl+T | Send a literal Ctrl+T |
Ctrl+T then Ctrl+H | Show help (list all shortcuts) |
Ctrl+T then Ctrl+Q | Quit miniterm |
Ctrl+T then Ctrl+B | Send break |
Ctrl+T then Ctrl+D | Toggle DTR |
Ctrl+T then Ctrl+R | Toggle RTS |
Ctrl+T then Ctrl+P | Change port settings |
Ctrl+T then Ctrl+E | Toggle local echo |
Ctrl+T then Ctrl+F | Toggle filter (cycles through filters) |
Ctrl+T then Ctrl+L | Toggle EOL mode |
Ctrl+T then Ctrl+I | Show port info (baud, data bits, parity, stop bits) |
Ctrl+T then Ctrl+U | Upload 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 --askOr list ports separately:
python -m serial.tools.list_portsThis 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.txtThe --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 CRLFDebug binary protocols. When you need to see raw bytes:
python -m serial.tools.miniterm /dev/ttyUSB0 115200 --filter debug --rawSCPI instrument control. Send SCPI queries interactively. See SCPI over Serial for full details.
python -m serial.tools.miniterm /dev/ttyUSB0 9600 --eol LFThen type *IDN? and press Enter.