If you haven’t a GUI to run your preferred email client or a browser, and you need to check if you have received new mails in your gmail account, you can use your favourite shell in conjuction with the CURL application.

CURL is a swiss knife for the internet protocols.

When you run the following simple (simple?) command, you will be asked for the password of your  gmail account, and then it will swho to you the list of the new unread messages:


$ curl -u username --silent "https://mail.google.com/mail/feed/atom" | perl -ne 'print "\t" if /<name>/; print "$2\n" if /<(title|name)>(.*)<\/\1>/;'

Enter host password for user 'user'::

and the output will be like the following:

Gmail - Inbox for user@gmail.com</title><tagline>New messages in your Gmail Inbox</tagline><fullcount>1</fullcount><link rel="alternate" href="https://mail.google.com/mail" type="text/html" /><modified>2015-05-26T04:11:50Z</modified><entry><title> New mail message in inbox

The tag <fullcount> will show how many new and unread messages are waiting in your gmail, while the <title> will show the title of each waiting message.

Remeber to change username to your gmail lusername in the command line.