Print a random tweet from the command line

Aug 27, 2010 - Leave a Comment

Twitter icon

By pasting the following small function into your .profile, you’ll be able to print random tweets from any Twitter feed:

Once the code is saved into your .profile just type ‘randomosx’ to get a random tweet:
$ randomosx
New: iMac Touch runs both Mac OS X and iOS #apple #mac

In the example code, we are using the OS X Daily Twitter feed, but “shitmydadsays” and “ConanOBrien” both make for a hilarious random tweets. You can also change the function name to something like ‘randomtweet’ or whatever else to fit the feed you are randomizing.

This works in Mac OS X and Linux, and should work in other unix environments as well.

If you like this, why not learn to post tweets from the command line too? Have fun!

Enjoy this tip? Subscribe to the OSXDaily newsletter to get more of our great Apple tips, tricks, and important news delivered to your inbox! Enter your email address below:

Related articles:

Posted by: chrisk in Command Line

Leave a Reply


Shop on and help support OSXDaily!

Subscribe to OSXDaily

Subscribe to RSS Subscribe to Twitter Feed Follow on Facebook Subscribe to eMail Updates

Tips & Tricks


iPhone / iPad



Shop on Amazon to help support this site