7

How to know what USB devices had connected to my Ubuntu 12.04 PC. I've read this but I didn't get satisfied since i dont know how to deal with the log file to collect the data I need.

Also, I want to search for old connected USBs not during real time.

That is, I want a tool or any way that manage and monitor which USBs is connected to my PC.

3 Answers 3

10

lsusb should give you a good idea.

There are variants on that (like adding the -v flag to that) or alternative that do roughly the same job like sudo lshw which covers all hardware.

2
  • 2
    Or you can get a tree view of the devices with lsusb -t command
    – Anwar
    Sep 10, 2012 at 14:45
  • 1
    lsusb is a utility for displaying information about USB buses in the system and the devices connected to them. This is from man page of lsusb...This means that lsusb tracks USB devices that are connected while i need more than real time monitoring.
    – user61928
    Sep 10, 2012 at 15:38
4

There is another way to see all USB devices in Ubuntu using command Line. It is hwinfo.

If you don't have it, install it with sudo apt-get install hwinfo, or Using software center by clicking on the link bellow:

Install via the software center

After installation, to see all USB devices with necessary info , use sudo hwinfo --usb. It will give you detail information about all USB devices in your system. You may want to save it in a text file using redirecting feature, such as sudo hwinfo --usb > usb-info.

There will be a file in current directory with name usb-info containing all information of USB devices.

manpage for the hwinfo command Manpage icon

Real time monitoring of the log:

For real-time monitoring of the log, you can use tail command, which shows the last fews lines of a file.

To do so, open a terminal and execute this command

 tail -n15 -f /var/log/syslog

This will show you last 15 lines in the log file. Change the number of lines in the option if you need. Now try inserting a USB device and removing it. The terminal will show you the messages. When you want to exit, just press Ctrl+C keyboard shortcut.

See the tail manual here for more info → manpage for the tail command Manpage icon

3
  • 1
    It still real time monitoring... I need more
    – user61928
    Sep 10, 2012 at 15:40
  • 1
    I think you need monitoring while happening, which is actually real time monitoring
    – Anwar
    Sep 10, 2012 at 15:44
  • @maythux see my updated answer
    – Anwar
    Sep 10, 2012 at 17:50
0

There is another way to see all USB devices in Ubuntu from the terminal. It is hwinfo.

If you don't have it, install it with sudo apt-get install hwinfo .

output-------09: USB 00.2: 0000 Unclassified device
  [Created at usb.122]
  Unique ID: Zep9.i2R0MkcceJ5
  Parent ID: k4bc.2DFUsyrieMD
  SysFS ID: /devices/pci0000:00/0000:00:14.0/usb1/1-10/1-10:1.2
  SysFS BusID: 1-10:1.2
  Hardware Class: unknown
  Model: "GiONEE P5L"
  Hotplug: USB
  Vendor: usb 0x271d "GiONEE"
  Device: usb 0x2017 "P5L"
  Revision: "ff.ff"
  Serial ID: "AM6PFEO7WS7STSFE"
  Speed: 480 Mbps
  Module Alias: "usb:v271Dp2017dFFFFdc00dsc00dp00icFFisc42ip01in02"
  Config Status: cfg=new, avail=yes, need=no, active=unknown
  Attached to: #7 (Hub)

You must log in to answer this question.