check-gmail.py is a Python script that uses your account's Atom feed to display the subjects and senders of your 20 most recent new messages. Works well for me. You'll need to make sure you have the "feedparser" and "urllib" bindings for Python installed (they ought to be available through your distribution's package manager, assuming it has one).
There's also a Perl script, if that's your preference, which does roughly the same thing:
http://www.swaroopch.info/archives/2...1/check_gmail/
If you're a Python scripter, there's always libgmail, a Python binding for interacting with Gmail:
http://libgmail.sourceforge.net/
The home page includes a simple python script which (quoting the site) "logs into an account, retrieves a list of threads, displays information about them and displays the source of the individual messages". Trying the sample code myself, I get an error and the output is ugly (though it does include useful information). I have a _little_ Python knowledge, so I may play with it a bit myself.
There may be more command-line options out there; I'm still looking.
Good luck!