Twitter used to have the air of a geek service but that was before Oprah. Now, however, if you want people to recognize your true geekdom, you have to exercise a little more creativity. In that fix myself, I thought, “What’s the geekiest way to tweet?” The answer came to me immediately — do it from the Linux command line.
The Simple Way
The Twitter API is pretty simple, so you don’t really need to have any specialized client if all you want to do is submit your tweets. If you have curl installed, you have all you need; if you don’t, from Debian or Ubuntu you can just do apt-get install curl as root from the command line. Once you have curl, you can submit a tweet really easily. Just do curl -u “user:pw” -d “status=Your tweet here” http://www.twitter.com/statuses/update.xml replacing “user:pw” with your username and password and “Your tweet here” with your tweet. You’ll get a bunch of messy output, which, once you know you’ve got it working, you can route away by ending the command with: > /dev/null
Still too much typing?
Put it in a shell script. For example: #!/bin/bash curl -u “user:pw” -d “status=$1″ http://www.twitter.com/statuses/update.xml >/dev/null (again replacing “user:pw” with your username and password). Save the script as, for example, /usr/bin/tweet, make it executable by chmod 755 tweet and then all you need to do to send your tweet is: tweet “Your tweet here” That’s the simple way. However, if you need to access the fancier features of Twitter — and you probably will — you will either have to go to the web interface and give up your geek status, or resort to the fancy way.
The Fancy Way
If all of this looks too much like coding to you, there is already at least one good command-line Twitter client. It’s called twyt, and was written by Andrew Price. It’s much more full-featured than the example above; in addition to posting tweets, it will let you follow the public timelines, your friends’ tweets, direct messages and @tweets. You’ll have to have the Python programming language installed — most Linux distros already do — and you must install python-simplejson. When that’s done, you’ll be able to issue simple commands like: twyt tweet “Your tweet here” twyt friendstl That’s probably all you’ll need to get started; the manual included with twyt will explain more. Happy tweeting from the command line!
Incoming search terms:
- twitter command line
- twitter command line client python
- ubuntu console twitter client
- ubuntu twitter client shell