Using Twitter from the command line with Twyt
Twitter is a fun micro-blogging service, but I’m not a huge fan of the web interface for it. Fortunately the kind folks at Twitter have made anÂ APIÂ available and many third party applications have sprung up to use it.
TwytÂ is an easy to use and powerful way to work with Twitter from the command line. You can install it from a terminal in Debian and Ubuntu using:
# aptitude update && aptitude install python-twyt
Remember to add sudo if you use sudo (most people on Ubuntu do) and replace aptitude with apt-get if you use apt-get.
Depending on which version of Twyt you’re using (I’ve got 0.8.5 on a workstation running Ubuntu Intrepid Ibex and 0.9.0 on a web server running Debian Lenny) setting up your user name and password will vary a bit:
# twyt user -u USERNAME -p PASSWORD set
# twyt savepass -u USERNAME
Enter USERNAME's Twitter password:
Posting to twitter can be done with:
# twyt tweet "content of post to twitter"
To print the last 20 tweets from your friends:
# twyt friendstl
To print the last 20 direct messages to you:
# twyt directtl
Sending a direct message is done with:
# twyt direct RECIPIENT "content of direct message"
The man page for Twyt is fairly good, and runningÂ
twyt COMMAND --helpÂ will get you on the right track in most cases.
Getting Twyt on Arch Linux is best done from theÂ AUR. This is a little more complex to configure at first (like so many things in Arch Linux) so if you’re interested and are new to installing software from the AUR you’ll want toÂ read the fine manual.