# Finding the right serial port name

To communicate with a device, you first need to [open the serial port](https://software.zaber.com/motion-library/docs/tutorials/code.md) that it's connected to.
Before that, you need to know the name of the serial port to use.
Select your operating system to find instructions for determining the serial port name:

> **Windows:**
>
> 1. Open Windows Device Manager.
> 2. Find "Ports (COM & LPT)" in the list.
> 3. Expand "Ports (COM & LPT)" to see the names of all serial ports.
>
> The title of your serial port depends on the way you connect the device to the computer:
>
> | Type of connection | Example title |
> | --- | --- |
> | Onboard serial port of the computer | `Communications Port (COM3)` |
> | USB to Serial adaptor, such as Zaber's X-USBDC connector | `USB Serial Port (COM3)` |
> | Direct USB connection on a standalone controller | `X-MCB2 (COM3)` |
>
> In any case, the port name is the text in brackets (i.e. `COM3` in the previous examples).
>
> If there are multiple ports that look like they may be valid, you may need to try them to see which connection works.
>
> See a video of how to find the port name.
>
> [video](https://software.zaber.com/dev-portal/motion-library/docs/assets/videos/com-port.mp4)Your browser does not support the video tag.

> **Linux:**
>
> Enter the following command in a terminal:
>
> ```bash
> ls /dev | grep -E 'ttyUSB|ttyACM'
> # Example output:
> # ttyUSB0
> ```
>
> If you are using USB to connect your devices, the output will likely be `ttyUSB0`. The port name is the output with the directory included: `/dev/ttyUSB0`.

> **Mac OS:**
>
> Enter the following command in a terminal:
>
> ```bash
> ls /dev/tty.*
> # Example output:
> # tty.usbserial-A4017DXH
> ```
>
> If you are using USB to connect your devices, the output will look something like `tty.usbserial-A4017DXH`. The port name is the output with the directory included: `/dev/tty.usbserial-A4017DXH`.

## Example Code

We have a Python [COM Port Scan example](https://github.com/zabertech/zaber-examples/tree/main/examples/util_com_port_scan) that shows how to
programmatically check all serial ports for Zaber devices.
