macos Mac 命令行 - 列出可用的串行端口?

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/3815211/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-10-21 07:14:24  来源:igfitidea点击:

Mac Command Line - List Available Serial Ports?

macoscommand-lineserial-port

提问by TheDarkIn1978

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

在我的 Mac 上,我目前有可用的串行端口:

  • /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
  • /dev/tty.usbserial-A700dYoR
  • /dev/cu.usbserial-A700dYoR
  • /dev/tty.Bluetooth-PDA-Sync
  • /dev/cu.Bluetooth-PDA-Sync
  • /dev/tty.蓝牙调制解调器
  • /dev/cu.蓝牙调制解调器

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

是否可以从命令行(终端)检索计算机可用串行端口的列表?

回答by TheDarkIn1978

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
  • /dev/tty.usbserial-A700dYoR
  • /dev/tty.Bluetooth-PDA-Sync
  • /dev/tty.蓝牙调制解调器
  • /dev/cu.usbserial-A700dYoR
  • /dev/cu.Bluetooth-PDA-Sync
  • /dev/cu.蓝牙调制解调器

回答by Jubei

You can do it with a single command:

您可以使用一个命令来完成:

ls /dev/{tty,cu}.*