OK serial terminal 🔌〡〇〡〇〡💻
An interactive serial port terminal, built on ok-serial.
Think twice before using this! Consider something more established:
- tio - not Python, but a great serial terminal utility
- picocom - the classic minimal serial terminal
- screen - the terminal multiplexer is also a serial terminal
- minicom - if you're nostalgic for the DOS era
- pyserial's miniterm -
python -m serial.tools.miniterm, already installed if you have pyserial
Installation and Usage
Install the Python package, which installs the okterm utility:
pip install ok-serial-terminal
# or 'uv add ok-serial-terminal', 'uv tool install ok-serial-terminal', etc.
okterm <port> [baud]
OR, skip the package install and run it directly with uvx or pipx:
uvx ok-serial-terminal <port> [baud]
# or `pipx run ok-serial-terminal <port> [baud]`
The baud rate defaults to 115200 if omitted. The port is an ok-serial match expression, so okterm RP2040, okterm 2e8a:0005, and okterm /dev/ttyACM0 all work. Run okserial (or uvx ok-py-serial) to list visible ports and their attributes.
On a terminal (unless --plain is given), okterm decorates the display with connection status, control signal state, and an indicator for unechoed typed characters. In this mode, ctrl-] opens a menu and ctrl-\ quits.
In plain mode (I/O redirected or --plain given), data is pass-through and ^C quits.
See okterm --help for more options (locking mode, etc).
Socat for testing and profit
On Unix-ish systems, socat is handy for connecting serial-port apps (okterm or otherwise) to non-serial endpoints (like a Unix program or a TCP socket). Install it with your favorite package manager (eg. sudo apt install socat), and run something like this in one window:
socat pty,raw,echo=0,link=socat.tmp exec:$SHELL,pty,stderr,setsid,ctty
The first socat argument pty,raw,echo=0,link=socat.tmp allocates a pseudoterminal (pty) that looks like a serial port, and creates a ./socat.tmp symlink to the device. The ,raw,echo=0 suppresses default pty echo behavior to avoid the shell looping on its own output.
The second socat argument starts a shell on its own pty, but this could be any socat endpoint (exec:cat, tcp:localhost:8000, etc).
Socat will then shuffle data between the two points. Try this in another window (in the same directory):
okterm socat.tmp
You should get a terminal connected to the pty socat allocated; hit enter and you should see a shell prompt.
(None of this is okterm-specific — as far as ok-serial is concerned ./socat.tmp is just another serial port, so ok_serial.SerialConnection(match="socat.tmp", baud=115200) works the same way from your own code.)
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file ok_serial_terminal-0.1.tar.gz.
File metadata
- Download URL: ok_serial_terminal-0.1.tar.gz
- Upload date:
- Size: 21.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.11.19 {"installer":{"name":"uv","version":"0.11.19","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"26.04","id":"resolute","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
2638005a39e58ffcb74c6959bb94b5a99afa66f9e4d49f99b8d96cc51ac56e39
|
|
| MD5 |
07e42e836c837d69c7305f5d62d63c36
|
|
| BLAKE2b-256 |
12396f2245a06d1a1a305111637a614f988ea903bcdb3d1fee179b651b88b564
|
File details
Details for the file ok_serial_terminal-0.1-py3-none-any.whl.
File metadata
- Download URL: ok_serial_terminal-0.1-py3-none-any.whl
- Upload date:
- Size: 24.9 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.11.19 {"installer":{"name":"uv","version":"0.11.19","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"26.04","id":"resolute","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
18830f5b89efb5b4984279578d3dc2589f4e0cf5308f180e24fd7145b35e5011
|
|
| MD5 |
a8326d3dff9ff2e2a5e9923d2eb9d767
|
|
| BLAKE2b-256 |
ca27ee978913aefcca6c368842d178068675d9e6f4301ae9b5be9a14c7bcb0ad
|