Leonardo: serial output does not keep pace

Hi all,
I have a small sketch that reads values from a led and writes them to the serial output. In the Serial Monitor they display just fine.

The output consists of a line number, a space and the value read.

To read them from the command line I first close the Serial Monitor. Then the problems begin.

'cat /dev/ttyACM0' only displays the first two lines and exits.
'tail -f /dev/ttyACM0' does the same and then nothing

'while head -1 /dev/ttyACM0 ; do : ; done' displays continuously, but skips every fifth or sixth line or so.

The same goes for 'while : ; do cat < /dev/ttyACM0 ; done'

I use Ubuntu, Bash and the last build of Arduino. Baudrate is set to 9600, which should not be too fast.

Any suggestions are welcome.

When you use the Leonardo's native USB connection the baud rate has no effect. The data is sent at full USB speed.

That is useful to know. but does dat explain the erratic behaviour?

paai:
Does that explain the erratic behavior?

I wouldn't think so but I could not be sure.

From the Leonardo data:

"The Leonardo differs from all preceding boards in that the ATmega32u4 has built-in USB communication, eliminating the need for a secondary processor. This allows the Leonardo to appear to a connected computer as a mouse and keyboard, in addition to a virtual (CDC) serial / COM port. It also has other implications for the behavior of the board; these are detailed on the getting started page"

I do not know anything about the Leonardo except what I have read, but I would think that the baud rate affects the USB port if it is simulating a virtual (CDC) serial/Com port. and the data is being sent serially over that virtual port. But, hey! I am very ignorant of the ability of that board.