The following will do real time tracking using gpsbabel and write it to a file for my Etrex 10
gpsbabel -T -i garmin,baud=38400,get_posn -f /dev/ttyUSB0 -o nmea -F mylocation.nmea
gpsbabel -T -i garmin,baud=38400,get_posn -f /dev/ttyUSB0 -o nmea -F mylocation.