Skip to main content
30 votes

How to connect to a serial port as simple as using SSH?

Try http://tio.github.io "tio" is a simple TTY terminal application which features a straightforward commandline interface to easily connect to TTY devices for basic input/output. Typical use is ...
Martin's user avatar
  • 401
26 votes

reading from serial from linux command line

I am monitoring output for arduino uno like: screen /dev/ttyUSB0 9600
gjerich's user avatar
  • 261
23 votes

How to send data to a serial port and see any answer?

This could be a better approach: stty -F /dev/ttyUSB0 115200 raw -echo #CONFIGURE SERIAL PORT exec 3</dev/ttyUSB0 #REDIRECT SERIAL OUTPUT TO FD 3 cat <&3 > /tmp/...
Leonardo Mendoza's user avatar
22 votes

How to send data to a serial port and see any answer?

Programs that talk to serial devices: picocom minicom socat or from shell you can do: stty -speed 19200 < /dev/ttyS0 # sets the speed of the port exec 99<>/dev/ttyS0 (or /dev/ttyUSB0...etc)...
Zibri's user avatar
  • 583
21 votes

How to connect to a serial port as simple as using SSH?

This script is based on another answer, but sends everything over the serial port (except Ctrl+Q), not just single commands followed by Enter. This enables you to use Ctrl+C or Ctrl+Z on the remote ...
Fritz's user avatar
  • 718
19 votes
Accepted

Find and kill the process that is using a serial port

killall expects a substring of the program's name as argument. To kill a process by its process ID, use kill. You can directly kill all the processes that have a file open with the command fuser. ...
Gilles 'SO- stop being evil''s user avatar
15 votes

command to determine ports of a device (like /dev/ttyUSB0)

Assuming that you know what the device you plugged in is, in 14.04 Ubuntu, at least, there is the command usb-devices that you can look through and find the information: $ usb-devices T: Bus=01 Lev=...
Gertlex's user avatar
  • 271
14 votes

How to bind USB device under a static name?

The multiple-identical-USB-device problem I have a Rasperry Pi with four cameras. I take pix with fswebcam which identifies the cameras as /dev/video0 .. video3. Sometimes the camera is video0, ...
Ian Boag's user avatar
  • 269
14 votes

terminate screen monitoring serial port

I run all my terminals inside a screen, and also sometimes use screen to connect to serial. If you screen /dev/ttyUSB0 inside screen, you'll just get a new window in your current session, not a new ...
arantius's user avatar
  • 270
13 votes
Accepted

Switch tabs in Debian installer over serial console with PuTTy

It looks like the Debian installer might use the well-known screen utility to implement multiple tabs on a serial console, so use its key combinations to switch tabs: Ctrl+A, then 1-4 An alternative ...
telcoM's user avatar
  • 103k
13 votes

extra \x0D appended when echo \0x0A

If you want bytes to be transmitted as-is across a serial connection both ways, you need to tell the system it's not to be used as a terminal device, either by detaching the tty line discipline from ...
Stéphane Chazelas's user avatar
12 votes
Accepted

extra \x0D appended when echo \0x0A

You need to disable newline conversion: stty -F /dev/ttyS2 -onlcr or, for strict POSIX stty: stty -onlcr < /dev/ttyS2
Stephen Kitt's user avatar
10 votes

How can I monitor serial port traffic?

interceptty does that job: interceptty /dev/ttyACM0 /dev/ttyDUMMY or, with a nice output format and with configuring the backend device, and with line buffering: interceptty -s 'ispeed 19200 ospeed ...
Golar Ramblar's user avatar
9 votes

How to use virtual serial port without root privileges?

I found an answer after pouring through the man page for socat. You can add mode and group to the attributes of your pty by adding a few more expressions to your command line. To follow your example, ...
Efpophis's user avatar
9 votes

Difference between PPP, QMI and AT commands

A LTE modem can be presented to the operating system in several ways. The legacy way is to emulate a legacy analog modem: in that case, the modem will present one serial (TTY) interface (/dev/ttyUSB0),...
telcoM's user avatar
  • 103k
8 votes

Cloning/Splitting a serial port (COM) port in Ubuntu

While a previous answer said it cannot be shared, this is partly wrong. A linux TTY port can be opened with different applications ( if they don't use or check for locks), however data will be ...
vittorio88's user avatar
8 votes
Accepted

How do I spoof different device ID for the purposes of Linux device management?

You can see the module(s) that would be loaded for USB device with vendor:product IDs 1199:9079 with: sudo modprobe -c | grep usb:v1199p9079 The results will be similar to: alias usb:v1199p9079d*dc*...
telcoM's user avatar
  • 103k
7 votes

How can I monitor serial port traffic?

This is the way I finally choose Thanks to Gilles's answer! strace -s 9999 -e read -ffp $(sed '/ttyUSB0/s/^.*proc.\([0-9]\+\).fd.*/\1/p;d' <(ls -l /proc/[1-9]*/fd/* 2>/dev/null)) |& perl -e '...
F. Hauri  - Give Up GitHub's user avatar
7 votes

How can minicom "permanently" translate incoming newline (\n) to CR+LF?

ANSWER: In minicom press Ctrl+A Z. This will show the menu. Then press U ("Add Carriage Ret"), and minicom will add the CR symbol to each LF symbol automatically. You may want to do that again in ...
v_2e's user avatar
  • 191
7 votes
Accepted

reading serial port parameters from the terminal

Use stty instead: stty -F /dev/ttyS0 -a Example output: speed 9600 baud; rows 0; columns 0; line = 0; intr = ^C; quit = ^\; erase = ^?; kill = ^U; eof = ^D; eol = <undef>; eol2 = <undef>...
hschou's user avatar
  • 2,930
7 votes
Accepted

QEMU more than 4 serial ports

recompiling seems to work for all 8 ports. 1) linux-host limitation solved by: /etc/default/grub: 8250.nr_uarts=8 ... update grub 2) qemu limitation solved by: git clone git://git.qemu-project.org/...
MetNP's user avatar
  • 510
7 votes

Switch tabs in Debian installer over serial console with PuTTy

In addition to @telcoM answer: For those running the Debian installer through screen itself, like a UART connection to some monitor-less device, you can't use Ctrl+a directly. That would be picked up ...
Forage's user avatar
  • 171
7 votes

Simulating an input from ttyS0 in Linux

TIOCSTI is available, but that's not a highly regarded mechanism nowadays. An alternative is very simple: this is what pseudo-terminals do. Just point the scanner at a pseudo-terminal instead of the ...
JdeBP's user avatar
  • 69.9k
6 votes

How to connect to a serial port as simple as using SSH?

Another issue that can occur is that your user account may need to set to the "dialout" group to access the serial port. sudo usermod -a -G dialout $USER
dfowler7437's user avatar
6 votes

command to determine ports of a device (like /dev/ttyUSB0)

I found @phemmer's accepted answer regularly helpful and turned it into a bash script. I added shell process backgrounding to make it run a bit faster for lots of USB devices connected to a system (...
user8472's user avatar
6 votes

Testing QinHeng Electronics HL-340 USB-Serial adapter

lsusb lists the device here as Bus 003 Device 002: ID 1a86:7523 QinHeng Electronics HL-340 USB-Serial adapter It is often shipped together with the sds011 sensor. The required kernel module is ...
Jonas Stein's user avatar
  • 4,168
6 votes
Accepted

How to monitor a serial connection @ 250000 baud?

There are some undocumented ioctls you can use to set non-standard speeds, provided the driver implements them. A simple way to call them is with a small piece of python. Eg put in file mysetbaud.py ...
meuh's user avatar
  • 52.3k
6 votes
Accepted

How to set custom permissions on /dev/ttyS0 so that they persist after reboot?

you can check the group owner of /dev/ttyS0 with: ls -l /dev/ttyS0 and then add your user in this group: usermod -a -G {group-name} username
blametheadmin's user avatar

Only top scored, non community-wiki answers of a minimum length are eligible