Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

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

share|improve this question
add comment

2 Answers

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
add comment

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
add comment

Your Answer

 
discard

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.