---
name: "ldattach"
section: "8"
platform: "openbsd"
package: "man"
version: "8.0-current-20261101"
release: "OpenBSD 8.0-current (2026-11-01)"
platforms: ["linux", "openbsd"]
url: "https://new.carta.tech/ldattach"
---

# ldattach(8)

attach a line discipline to a serial line

## NAME

**ldattach** – attach a line discipline to a serial line

## SYNOPSIS

**ldattach** \[**-27dehmop**\] \[**-s** *baudrate*\] \[**-t** *cond*\] *discipline* *device*

## DESCRIPTION

**ldattach** is used to attach a line discipline to a serial line to allow for in-kernel processing of the received and/or sent data. Depending on the line discipline being attached, one or more options may be applied.

**ldattach** can be run from the command line or at system startup by having [init(8)](/init/8.md) read [ttys(5)](/ttys/5.md) entries to attach line disciplines.

The following options are available:

- **-2**

  Use 2 stopbits instead of 1.

- **-7**

  Use 7 databits instead of 8.

- **-d**

  Do not daemonize.

- **-e**

  Use even parity.

- **-h**

  Turn on RTS/CTS flow control. By default, no flow control is done.

- **-m**

  Maintain modem control signals after closing the line. Specifically, this disables HUPCL.

- **-o**

  Use odd parity.

- **-p**

  Pass the data received from *device* to the master device of a [pty(4)](/pty/4.md) pair and vice versa. The name of the slave device is written to standard output.

- **-s** *baudrate*

  Specifies the speed of the connection. If not specified, the default of 9600 baud is used (4800 baud for [nmea(4)](/nmea/4.md)).

- **-t** *cond*

  [nmea(4)](/nmea/4.md), [msts(4)](/msts/4.md) and [endrun(4)](/endrun/4.md) line disciplines only. Chooses the condition which will cause the current system time to be immediately copied to the terminal timestamp storage for subsequent use by [nmea(4)](/nmea/4.md), [msts(4)](/msts/4.md) or [endrun(4)](/endrun/4.md). Only one can be used.

  - dcd

    Copy the timestamp when DCD is asserted.

  - !dcd

    Copy the timestamp when DCD is deasserted.

  - cts

    Copy the timestamp when CTS is asserted.

  - !cts

    Copy the timestamp when CTS is deasserted.

    If no condition is specified, the [nmea(4)](/nmea/4.md) line discipline will timestamp on receiving the leading ‘$’ character of each block of NMEA sentences.

- *discipline*

  Specifies the name of the line discipline to be attached.

  - endrun

    Attach the [endrun(4)](/endrun/4.md) line discipline.

  - msts

    Attach the [msts(4)](/msts/4.md) line discipline.

  - nmea

    Attach the [nmea(4)](/nmea/4.md) line discipline.

- *device*

  Specifies the name of the serial line. *device* should be a string of the form “cuaXX” or “/dev/cuaXX”.

  [cua(4)](/cua/4.md) devices should be used when **ldattach** is started from the command line; when started using [init(8)](/init/8.md), [tty(4)](/tty/4.md) devices should be used.

If **ldattach** was not started by [init(8)](/init/8.md), the line discipline can be detached by killing off the **ldattach** process.

## EXAMPLES

To start **ldattach** using [init(8)](/init/8.md) to attach the [nmea(4)](/nmea/4.md) line discipline to */dev/tty01* at 4800 baud using a device without a carrier (DCD) line, add a line of the following form to */etc/ttys*:

```
tty01	"/sbin/ldattach nmea"	unknown	on softcar
```

## SEE ALSO

[endrun(4)](/endrun/4.md), [msts(4)](/msts/4.md), [nmea(4)](/nmea/4.md), [pty(4)](/pty/4.md), [tty(4)](/tty/4.md), [ttys(5)](/ttys/5.md), [init(8)](/init/8.md)

## HISTORY

The **ldattach** command first appeared in OpenBSD 4.3.
