Twittering from the command line

So I was experimenting with Twitter last night and started to use their RESTful services from the command line. 

Why you may ask? Well sometimes I just want to tweet something quickly and I don’t want to bother with opening a client or web page.  So I through together this simple bash script.

tweet()
  {
    curl -u <username>:<password> -d status=”$1″ http://twitter.com/statuses/update.xml
  }

Simply add this to your .bash_profile and you can tweet from the command line all day.

tweet “Tweeting from the command line is awesome!” 

I love RESTful services despite popular belief.  :-)  

Related Articles:

    Post Footer automatically generated by Add Post Footer Plugin for wordpress.

    About Joe Ocampo

    My personal philosophy is simple: "Have a good strategy that sets the environment for success through the enablement of the whole. Be agile but with a mind towards pragmatism. Delegate to the best qualified individuals, but don’t be afraid to involve yourself in all parts of a job. Treat everyone with respect, humility, and with a genuine pursuit towards excellence." Respected business and technical leader with expertise in directing organization towards effective results driven outcomes. Proven ability to perform and communicate from both technical and business perspectives. Strong technical and business acumen developed through experience, education and training. Provides the ability to utilize technology, harness business intelligence and execute strategically by optimizing systems, tools and process. Passionate about building people, companies and software by containing cost, maximizing operational throughput and capitalize on revenue. Looks to leverage the strengths of individuals and grow the organization to their maximum potential by harnessing the power of their collective whole and deliver results. Co-Founder of LosTechies.com
    This entry was posted in Tools, Twitter. Bookmark the permalink. Follow any comments here with the RSS feed for this post.

    7 Responses to Twittering from the command line

    1. Worked for me!

      Awesome.

      Side notes: I put mine in my .bashrc file, same affect and I also had to install curl (apt-get install curl OR yum install curl).

    2. bogardj says:

      Haha that’s pretty cool. Reminds me of leetwit:

      http://code.google.com/p/leetwit/

    3. Joe Ocampo says:

      @jason
      Yeah I forgot that Mac’s have curl preinstalled

      Glad it worked.

    4. Joe Ocampo says:

      @jimmy

      interesting project, very nice! I must partake in such goodness.

    5. terry says:

      @joe

      pretty sure i should make an installer that adds your bash pwnage to leetwit. that would be pretty handy. weekend project woot.

    6. Joe Ocampo says:

      @terry

      That would be awesome Terry. Use you mad MacSkillz. :-)

    7. GBGames says:

      Just so you know, since I was unfamiliar with using curl, I thought that maybe it knew what : was, until I realized that I needed to replace those parts with my actual username and password.

      Also, if you don’t want to put your password in clear text in your .bash_profile, you can leave out : , and curl will prompt you for one each time you use it.