Skip to content

Instantly share code, notes, and snippets.

@tomasen
Last active October 13, 2024 04:17
Show Gist options
  • Save tomasen/e014d9a5d365c64a7fa31f23f97ec20e to your computer and use it in GitHub Desktop.
Save tomasen/e014d9a5d365c64a7fa31f23f97ec20e to your computer and use it in GitHub Desktop.
A one line command that lists connected USB devices along with their speeds on macOS. USB Hubs are filtered out.
system_profiler SPUSBDataType | awk -F": " '/^[[:space:]]*[^[:space:]].*:$/ { device=$1; sub(/^[[:space:]]*/, "", device); sub(/:$/, "", device) } /^[[:space:]]+Speed:/ { gsub(/^[[:space:]]+Speed: /, "", $0); if (device !~ /[Hh]ub/) print device " - " $0 }'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment