Check your unread Gmail email using Linux Command

by Sanju 2012-07-03 12:50:55

Check your unread Gmail email using Linux Command

Here is the command for those of you who use Gmail and would like to check for unread email without having to fire up a browser. This command makes use of: curl, tr, awk, and sed and looks like:

curl -u GMAIL_ADDRESS:GMAIL_PASSWORD --silent "https://mail.google.com/mail/feed/atom" | tr -d '\n' | awk -F '<entry>' '{for (i=2; i<=NF; i++) {print $i}}' | sed -n "s/<title>\(.*\)<\/title.*name>\(.*\)<\/name>.*/\2 - \1/p"


Where GMAIL_ADDRESS is your actual gmail address and GMAIL_PASSWORD is your gmail password.

The sender and subject of your unread Gmail will be printed out.
860
like
0
dislike
0
mail
flag

You must LOGIN to add comments