Mac Command Line - List Available Serial Ports?

2019-03-08 02:18发布

on my Mac, i currently have the available serial ports:

  • /dev/tty.usbserial-A700dYoR
  • /dev/cu.usbserial-A700dYoR
  • /dev/tty.Bluetooth-PDA-Sync
  • /dev/cu.Bluetooth-PDA-Sync
  • /dev/tty.Bluetooth-Modem
  • /dev/cu.Bluetooth-Modem

is it possible to retrieve a list of the available serial ports of the computer from the command line (terminal)?

2条回答
啃猪蹄的小仙女
2楼-- · 2019-03-08 02:30

ah... it is much easier than i though.

ls /dev/tty.*
ls /dev/cu.*

will list

  • /dev/tty.usbserial-A700dYoR
  • /dev/tty.Bluetooth-PDA-Sync
  • /dev/tty.Bluetooth-Modem
  • /dev/cu.usbserial-A700dYoR
  • /dev/cu.Bluetooth-PDA-Sync
  • /dev/cu.Bluetooth-Modem
查看更多
孤傲高冷的网名
3楼-- · 2019-03-08 02:33

You can do it with a single command:

ls /dev/{tty,cu}.*
查看更多
登录 后发表回答