Ask Ubuntu is a question and answer site for Ubuntu users and developers. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Because, I shared files but I don't remember how many person.

share|improve this question
up vote 1 down vote accepted

Look in your logfiles, new entries are added to /var/log/syslog each time a USB key is plugged.

You can open /var/log/syslog as root with a text editor (sudo gedit /var/log/syslog), or:

sudo grep "Attached.*disk" /var/log/syslog

To count:

sudo grep "Attached.*disk" /var/log/syslog | wc -l
share|improve this answer

I assume you mean you want to know how many times a flash drive was installed in a usb port on a particular computer.

Start a terminal with Alt+Ctrl+T and run:

tail -f /var/log/syslog

Now insert your thumb drive. You should see a line display like:

Aug 12 11:44:05 gruber-precise-laptop kernel: [ 1386.413812] scsi 8:0:0:0: Direct-Access     TOSHIBA  TransMemory      PMAP PQ: 0 ANSI: 0 CCS

Now you can cancel the tail -f command with CTRL+C, and enter:

grep "Toshiba  TransMemory" /var/log/syslog*

and see all the times the flash drive was installed recently.

You can pick something else in the string as well:

grep "0:0:0: Direct-Access" /var/log/syslog*

but this will pick up things like your disk drive and any card readers at boot time, so you will have to look at the name to tell which is which.

On my system:

grep "0:0:0: Direct-Access" /var/log/syslog* | egrep -v "ATA|Multi-Card" | wc -l

finds the discovery of all direct access devices, eliminates the ones that I get at boot (and maybe wake up) for my hard disk and multicard reader, and counts them.

On my system sudo isn't necessary for any of these commands.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.