How to extract a list of all devices that were connected to my PC before?
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.
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.
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:
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
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