I'm not that sophisticated, I guess something like this will have to do:

egrep "sd[b-e]|Mounted" /var/log/messages  | egrep -v -i
"installing|cache|error|write" | more


On Fri, Aug 10, 2012 at 9:37 AM, Michael Quick <[email protected]>wrote:

> Thanks for responding!  Basically I was looking to get a history of who
> has plugged in a USB drive to machine X.  What does this return on your
> system ? Notice FAT drives will not be found, I'm not sure how to search
> for them yet.  I also noticed that keyring spits out messages as well and I
> could try to use that.
>
> less messages* | egrep "ntfs-3g" | grep "Mounted"
> less messages* | grep "EXT[3-4]" | grep "sd[b-c]" | grep "mounted"
>
>
>
> On Thu, Aug 9, 2012 at 8:46 PM, Chris Knadle <[email protected]>wrote:
>
>> On Thursday, August 09, 2012 17:34:20, Michael Quick wrote:
>> > Hi,
>> >     In a bash script I want to list all of the USB drives that have been
>> > connected to my system. Anyone have a clue on the best way to do this ?
>>
>> It depends on what you're looking for.
>>
>> 'lsusb' can list USB devices, but that will only get you a device ID.
>>
>> If what you're looking for is a device you can *mount* then I suggest
>> looking
>> under /dev/disk/<subdirs> which is the area where udev.  Within there are
>> several subdirectories:
>>
>>    /by-label/   -> you can mount devices by drive label
>>    /by-uuid/    -> you can mount by filesystem UUID
>>    /by-path/    -> you can mount device partitions by path
>>    /by-id/      -> you can mount filesystems by device ID
>>
>>   -- Chris
>>
>> --
>> Chris Knadle
>> [email protected]
>> _______________________________________________
>> Mid-Hudson Valley Linux Users Group                  http://mhvlug.org
>> http://mhvlug.org/cgi-bin/mailman/listinfo/mhvlug
>>
>> Upcoming Meetings (6pm - 8pm)                         Vassar College
>>   Sep 5 - OpenStack
>>   Oct 3 - Mobile Web Development
>>   Nov 7 - Typography: Physical Art to Digital Art
>>
>
>
_______________________________________________
Mid-Hudson Valley Linux Users Group                  http://mhvlug.org
http://mhvlug.org/cgi-bin/mailman/listinfo/mhvlug

Upcoming Meetings (6pm - 8pm)                         Vassar College
  Sep 5 - Towards an Open Cloud with OpenStack
  Oct 3 - Mobile Web Development
  Nov 7 - Typography: Physical Art to Digital Art

Reply via email to