LinuxCommandLibrary

picocom

Connect to serial ports (COM ports)

TLDR

Connect to a serial console with the default baud rate of 9600

$ sudo picocom [/dev/ttyXYZ]
copy

Connect to a serial console with a specified baud rate
$ sudo picocom [/dev/ttyXYZ] [[-b|--baud]] [baud_rate]
copy

Map special characters (e.g. LF to CRLF)
$ sudo picocom [/dev/ttyXYZ] --imap [lfcrlf]
copy

Exit picocom
$ <Ctrl a><Ctrl x>
copy

Display help
$ picocom [[-h|--help]]
copy

SYNOPSIS

picocom [options] device

PARAMETERS

device
    The path to the serial port device (e.g., /dev/ttyUSB0 or /dev/ttyS0).

--baud rate, -b rate
    Sets the serial port communication speed, typically in bits per second (e.g., 9600, 115200).

--parity type, -p type
    Configures parity for data integrity checking. Options are 'n' (none), 'o' (odd), or 'e' (even).

--databits bits, -d bits
    Specifies the number of data bits per byte (usually 7 or 8).

--flow type, -f type
    Sets the flow control method: 'n' (none), 'x' (Xon/Xoff software flow control), or 'h' (hardware RTS/CTS flow control).

--escape char, -e char
    Defines the escape character used to issue commands to picocom. The default is Ctrl+a.

--nolock, -l
    Prevents picocom from creating a lock file for the serial device, allowing other processes to access it concurrently (use with caution).

--initstring string, -i string
    Sends an initialization string to the serial device immediately upon connection.

--echo, -c
    Enables local character echo, meaning characters typed on the keyboard are immediately displayed on the screen.

--no-init, -o
    Disables picocom's default serial port initialization. Useful if the device is already configured by another application.

--send-cmd cmd
    Specifies the external command to execute when sending a file (e.g., 'sz' for Zmodem), invoked by Ctrl+a Ctrl+s.

--receive-cmd cmd
    Specifies the external command to execute when receiving a file (e.g., 'rz' for Zmodem), invoked by Ctrl+a Ctrl+r.

--version, -v
    Displays the version information of picocom and exits.

--help, -h
    Shows the help message and exits.

DESCRIPTION

Picocom is a lightweight and simple serial communication program for Linux, often used to connect to embedded systems, modems, or network devices via their serial console ports. Unlike more feature-rich terminals like minicom, picocom focuses on providing basic, reliable serial access without complex menus, scripting, or integrated file transfer protocols. It supports common serial port settings such as baud rate, parity, data bits, and flow control. Its simplicity makes it ideal for quick debugging sessions or direct console access where a full-fledged terminal emulator is overkill.

CAVEATS

Picocom offers limited functionality compared to feature-rich terminal emulators like minicom, notably lacking built-in file transfer protocols (like Zmodem or Ymodem) or complex scripting capabilities. Users must manually manage file transfers via external commands configured with --send-cmd and --receive-cmd. Additionally, interacting with the serial port usually requires appropriate user permissions, such as being part of the 'dialout' or 'uucp' group, or using sudo.

COMMON USAGE AND EXITING

To connect to a serial device, you typically specify the device path and desired baud rate. For example, to connect to /dev/ttyUSB0 at 115200 baud, you would use:
picocom -b 115200 /dev/ttyUSB0

To exit picocom gracefully, use the default escape sequence: press Ctrl+a (the escape character), then immediately Ctrl+x. Other commands can be issued after Ctrl+a, such as Ctrl+s to send a file or Ctrl+r to receive one (if --send-cmd or --receive-cmd are configured).

HISTORY

Picocom emerged as a streamlined alternative to more complex serial terminal programs like minicom, designed for simplicity and minimal resource usage. Its development focused on providing core serial communication capabilities without the overhead of graphical interfaces or advanced features, making it particularly popular for embedded systems development and quick console access tasks on Linux.

SEE ALSO

minicom(1), cu(1), screen(1)

Copied to clipboard