commandlinefu.com is the place to record those command-line gems that you return to again and again.
Delete that bloated snippets file you've been using and share your personal repository with the world. That way others can gain from your CLI wisdom and you from theirs too. All commands can be commented on, discussed and voted up or down.
If you have a new feature suggestion or find a bug, please get in touch via http://commandlinefu.uservoice.com/
You can sign-in using OpenID credentials, or register a traditional username and password.
First-time OpenID users will be automatically assigned a username which can be changed after signing in.
Every new command is wrapped in a tweet and posted to Twitter. Following the stream is a great way of staying abreast of the latest commands. For the more discerning, there are Twitter accounts for commands that get a minimum of 3 and 10 votes - that way only the great commands get tweeted.
» http://twitter.com/commandlinefu
» http://twitter.com/commandlinefu3
» http://twitter.com/commandlinefu10
Use your favourite RSS aggregator to stay in touch with the latest commands. There are feeds mirroring the 3 Twitter streams as well as for virtually every other subset (users, tags, functions,…):
Subscribe to the feed for:
notice what happens when there is more than one unread message in a thread...
also people please dont hardcode the password when you use curl. Leave it out and curl will ask you when it runs. Please...?
There are 6 alternatives - vote for the best!
Checks the Gmail ATOM feed for your account, parses it and outputs a list of unread messages.
For some reason sed gets stuck on OS X, so here's a Perl version for the Mac:
curl -u username:password --silent "https://mail.google.com/mail/feed/atom" | tr -d '\n' | awk -F '<entry>' '{for (i=2; i<=NF; i++) {print $i}}' | perl -pe 's/^<title>(.*)<\/title>.*<name>(.*)<\/name>.*$/$2 - $1/'
If you want to see the name of the last person, who added a message to the conversation, change the greediness of the operators like this:
curl -u username:password --silent "https://mail.google.com/mail/feed/atom" | tr -d '\n' | awk -F '<entry>' '{for (i=2; i<=NF; i++) {print $i}}' | perl -pe 's/^<title>(.*)<\/title>.*?<name>(.*?)<\/name>.*$/$2 - $1/'
Just an alternative with more advanced formating for readability purpose. It now uses colors (too much for me but it's a kind of proof-of-concept), and adjust columns.
notice what happens when there is more than one unread message in a thread...
also people please dont hardcode the password when you use curl. Leave it out and curl will ask you when it runs. Please...?
If you can do better, submit your command here.
You must be signed in to comment.
Please don't copy from others
If you have libwww-perl installed, you can use the decode_entities function from HTML::Entities. This will make HTML entities like , ", etc. look prettier.
curl -u username --silent "https://mail.google.com/mail/feed/atom" | perl -MHTML::Entities -ne 'print "\t" if /<name>/; print decode_entities($2)."\n" if /<(title|name)>(.*)<\/\1>/;'LOL, and of course my comments show them as their decoded form. I am of course referring to the & nbsp; & quot;, etc. (I put a space between the ampersand and the rest of the entity.