Tweet from Command Line with t

By  on  

Tweet from Command Line

I've been obsessed with command line magic lately, as you may have noticed.  I don't plan on using every utility I've written about but I'm having fun learning about what's out there and how it's done.  My latest quandary was how one could tweet and perform other Twitter-centric tasks from the command line.  I found my answer:  t.

The t project README perfectly describes the process for installing t and the process you must follow to allow the app access to your account.  In short, you must create a Twitter app, provide t the proper API auth tokens, and enable the app within your account.  t is so well written, however, that it tells you exactly what to do and opens the necessary URLs in your browser.  t is an incredible utility.

The t project README also provides a host of command line instructions for tweeting, managing lists, etc.  Here are a few frequently used commands:

# Set the "active" account
t set active davidwalshblog

# Send a tweet
t update 'This is my epic command line tweet!' 
# >> Tweet posted by @davidwalshblog.  Run `t delete status 595038201179312128` to delete.

# Get user information
t whois davidwalsh

# Follow a user
t follow davidwalsh

# Get your timeline
t timeline

# Get your timeline listing with IDs, then get stats about a tweet
t timeline -l
t status {id}

# Get recent mentions
t mentions

# Get recent mentions with their ID so you can reply back
t mentions -l 
t reply {id} {message}

The commands I've shown above are just the tip of the iceberg.  t has loads of more advanced functionality available, and since all I/O is done via command line, you can use your other favorite command line utilities evaluate results, as shown here:

# Output the last 200 tweets in your timeline to a CSV file
t timeline -n 200 --csv > timeline.csv

I was up and running within t 5 minutes, despite needing to go through Twitter's API hoops.  And t is amazingly simple but very powerful, so I look forward to using it more in the future.  Kudos to its author and I look forward to seeing where this project goes!

Recent Features

  • By
    CSS 3D Folding Animation

    Google Plus provides loads of inspiration for front-end developers, especially when it comes to the CSS and JavaScript wonders they create. Last year I duplicated their incredible PhotoStack effect with both MooTools and pure CSS; this time I'm going to duplicate...

  • By
    How I Stopped WordPress Comment Spam

    I love almost every part of being a tech blogger:  learning, preaching, bantering, researching.  The one part about blogging that I absolutely loathe:  dealing with SPAM comments.  For the past two years, my blog has registered 8,000+ SPAM comments per day.  PER DAY.  Bloating my database...

Incredible Demos

  • By
    MooTools Equal Heights Plugin:  Equalizer

    Keeping equal heights between elements within the same container can be hugely important for the sake of a pretty page. Unfortunately sometimes keeping columns the same height can't be done with CSS -- you need a little help from your JavaScript friends. Well...now you're...

  • By
    Telephone Link Protocol

    We've always been able to create links with protocols other than the usual HTTP, like mailto, skype, irc ,and more;  they're an excellent convenience to visitors.  With mobile phone browsers having become infinitely more usable, we can now extend that convenience to phone numbers: The tel...

Discussion

  1. This is great, thanks for the share. I also can’t wait to see where this project goes!

  2. Ryan

    I’ve always wanted to Tweet in the terminal, so this is great

    All I need now is a Googling terminal utility and I’ll be set.

  3. Alessandro Belloni

    how can i “t update” with an image?

  4. Can i post a tweet with image?

Wrap your code in <pre class="{language}"></pre> tags, link to a GitHub gist, JSFiddle fiddle, or CodePen pen to embed!