Schedule a Tweet with One Comnand in Linux

Last updated: Mar 9, 2009

Ever want to schedule a tweet to go out at the same time an article is published or an event is started? Want to do it without signing up to a service or some other complicated task? Well this post is for you. I am going to show you how to schedule a tweet from the command line in one line of code. You can schedule the tweet to take place ten minutes from now, 14 days, or whenever you wish.

Twitter allows programmers and developers to interact with its service using its API. By sending small bits of XML code or POST data we can send updates or get our friend’s feeds. Fortunately Linux has some tools available to it that make this job easy.

To send a tweet from the Linux console all you have to do is send a small snippit of code through curl like:

curl -u email:password -d status="What is everyone's plan this weekend?" http://twitter.com/statuses/update.xml

To make it automated one time we use the ‘at’ command.

Suppose we want to issue a tweet out tomorrow morning at 5:00am when our post is released. To do this we would issue the following command:

at 5am tomorrow

At this point you will be prompted with the at console. This is so you can execute multi-line commands.

at-terminal

Type the following replacing email and password with your own.

curl -u email:password -d status="What is everyone's plan this weekend?" http://twitter.com/statuses/update.xml

Then hit enter. To tell at that you are now finished writing commands do, ctrl+d

To see the current queue just type:

atq

If you made a mistake you can remove a task by id:

atrm 6

Need to print shipping labels on your site?

Checkout my product RocketShipIt for simple easy-to-use developer tools for UPS™ FedEx™ USPS™ and more.

Get notified on new posts or other things I'm working on

Share: