89

I am running Ubuntu for the first time by booting from a USB drive. Now I have plugged in a USB-to-serial converter which has been recognized and automatically added as /dev/ttyUSB0.

How do I access /dev/ttyUSB0?

fosslinux
  • 3,881
700 Software
  • 2,337

11 Answers11

99

Use one of screen's lesser known features:

screen /dev/ttyUSB0
Marco Ceppi
  • 48,887
Douglas
  • 1,022
  • 38
    if you need to specify the baud rate, add it after the serial device. eg, for 57600 baud: screen /dev/ttyUSB0 57600 – Jeremy Kerr Mar 13 '12 at 12:45
  • 18
    Note that if you want to detach from the terminal and CTRL-D isn't cutting it, use CTRL-A then k to kill screen. I had to use this with the TTY at ~/Library/Containers/com.docker.docker/Data/com.docker.driver.amd64-linux/tty provided by Docker for Mac. CTRL-A then d will work too, but will leave your screen session running, which may or may not be what you want. – Vanessa Phipps Nov 17 '16 at 17:14
  • 1
    Most people using this will also want to specify -ixon: screen /dev/ttyUSB0 115200,-ixon. If this isn't specified and the remote device ever sends a 0x13 (^S), screen will start buffering everything you type and it won't send it until the remote device sends a 0x11 (^Q). See info screen 'Window Types' for more on this. – enigmaticPhysicist Apr 29 '23 at 11:27
17

You could use tio - a simple tty terminal I/O application:

tio /dev/ttyUSB0

See http://tio.github.io

13
busybox microcom -t 5000 /dev/ttyUSB0

Source: http://forum.xda-developers.com/showthread.php?t=1471241

Sepero
  • 4,637
8

You can use picocom, it is a minimal dumb-terminal emulation program. Basic usage is something like this (change 11520 to the desired baud rate):

$ picocom -b 115200 /dev/ttyUSB0

You have all the options you may want from a dumb-terminal program, like stop bits, parity, local echo, carriage return / line feed / backspace / delete / tab translation, X/Y/Z-modem and ASCII transfer integration, etc.

See man picocom and picocom --help for further information.

abu_bua
  • 11,333
6

you can use ckermit also. It should be in the repository. After installing it create a file in your home directory called .mykermrc then add the 5 following lines:

set line /dev/ttyUSB0   
set flow-control none  
set carrier-watch off  
set speed 115200  
connect 

parameters can be adjusted as necessary.
save the file.
to start it

sudo kermit 
5

You can use putty. Its an ssh/serial/telnet client for Windows and Linux. You can download it from http://linux.softpedia.com/get/System/Networking/PuTTY-347.shtml

binW
  • 13,204
4

Or

minicom -D /dev/ttyUSB0

If you need to configure it first, then

minicom -s

If you're wondering where's the meta key in MacOS, you will need to plan an escape. For other options, -h for help.

sean
  • 141
2

I was using puTTY to connect to the serial ports. But don't forget to add your user to dialout: sudo adduser <username> dialout then reboot the system.

After that, you can use puTTY for serial connections such as /dev/ttyUSB0.

2

Needed Mint 17.1 to talk to my Arduino, after a little chasing around, it turns out that your user must be part of the dialout group to use the tty. This should apply to Ubuntu as well. You can do so either by running the command:

sudo usermod -a -G dialout username

Or graphically, by using:

Administration → Users & Groups → Manage Groups

In which case you would go to the line for dialout, check the properties to ensure that username is ticked, if not username must be added.

This worked for me and by the look of lots of posts others have had the same problem.

Eliah Kagan
  • 119,820
  • 18
    -1 for sudo gedit /etc/group. Don't. Just don't. Learn how to add a user to a group using usermod or adduser for example. And your post is more of a comment rather than an answer to the question, because you don't actually show how to connect. – gertvdijk Dec 24 '14 at 14:36
1

Tio without GUI or CuteCom with GUI.

Honghe.Wu
  • 417
1

Using Lucid and a Dynamode USB to RS232 cable:

Plugged it in
ran kermit
set line /dev/ttyUSB0    <<-- mind the capitals/lowecase
connect
set speed 9600
...

and successfully connected to an RS232 port on an OpenVMS server.

Radu Rădeanu
  • 174,437
Henry Crun
  • 11
  • 1