GPS - how to get lat lon and time from a bash script file ?

Ed Kapitein ed at
Tue Feb 24 21:24:00 CET 2009

Hi kimaidou,

on om 2008.12 do:

-1 in settings turn on gps hardware
-2 start gpsd (/etc/init.d/gpsd start)
-3 read the gps data (gpspipe -r)

To check if you have a fix, you might want to clean out the lines that
have no lat/long info like this:

gpspipe -r | grep GPGGA | grep -v ',,,,,,'

And to get it in a human readable format you can use
gpspipe -r | dd count=20 |  gpsbabel -i nmea -f - -o gpx -F -

Please read the man pages of gpsd, gpspipe, dd and gpsbabel, they are
good starting points for learning
bash scripting.

For me echo p | nc -w1 0 gpsd  is *not* working.

Kind regards,

kimaidou wrote:
> Hi all
> I come back after some tests. I would like to stick on bash script for
> several reasons (don't want to load another instance of python just to
> record some sound, etc.). So among your answer, I tried to use one of
> this line
> echo p | nc -w1 0 gpsd | tr -d '\r\n' | cut -d'=' -f2
> But I got nothing in return. Could you please be more specific :
> * do I need to start gpsd first
> * will this work on every distribution, or do I need to change gpsd by
> fso-gpsd or anything else ?
> * how do I know I have a fix before using this line ?
> Thanks in advance
> ------------------------------------------------------------------------
> _______________________________________________
> Openmoko community mailing list
> community at

More information about the community mailing list