title: How to find all USB devices connected in Linux (Ubuntu)?
body: <p>I have found a script somewhere, which partially does what I want it to:</p>
  
  <pre><code>#!/bin/bash
  for sysdevpath in $(find /sys/bus/usb/devices/usb*/ -name dev); do
      (
          syspath="${sysdevpath%/dev}"
          devname="$(udevadm info -q name -p $syspath)"
          [[ "$devname" == "bus/"* ]] &amp;&amp; continue
          eval "$(udevadm info -q property --export -p $syspath)"
          [[ -z "$ID_SERIAL" ]] &amp;&amp; continue
          echo "{'name': '/dev/$devname', 'id_serial': '$ID_SERIAL'}"
      )
  done
  </code></pre>
  
  <p>But this way I am getting all connected devices:</p>
  
  <pre><code>{'name': '/dev/ttyACM3', 'id_serial': 'Arduino__www.arduino.cc__0043_74132343221092D0'}
  {'name': '/dev/input/event16', 'id_serial': 'Logitech_USB_Receiver'}
  {'name': '/dev/input/mouse2', 'id_serial': 'Logitech_USB_Receiver'}
  {'name': '/dev/hidraw0', 'id_serial': 'Logitech_USB_Receiver'}
  {'name': '/dev/usb/hiddev0', 'id_serial': 'Logitech_USB_Receiver'}
  {'name': '/dev/input/event17', 'id_serial': 'Logitech_USB_Receiver'}
  {'name': '/dev/hidraw1', 'id_serial': 'Logitech_USB_Receiver'}
  {'name': '/dev/ttyACM0', 'id_serial': 'Lenovo_N5321_gw_41C01111111A76M0'}
  {'name': '/dev/ttyACM1', 'id_serial': 'Lenovo_N5321_gw_41C0BAAAAD5A76M0'}
  {'name': '/dev/ttyACM2', 'id_serial': 'Lenovo_N5321_gw_41C0B11111111110'}
  {'name': '/dev/input/event15', 'id_serial': 'SunplusIT_INC._Integrated_Camera'}
  {'name': '/dev/media0', 'id_serial': 'SunplusIT_INC._Integrated_Camera'}
  {'name': '/dev/video0', 'id_serial': 'SunplusIT_INC._Integrated_Camera'}
  </code></pre>
  
  <p>How do I get only the <code>/dev/tty*</code> ones (not necessarily by using the same code)? </p>