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
    Page Visibility API

    One event that's always been lacking within the document is a signal for when the user is looking at a given tab, or another tab. When does the user switch off our site to look at something else? When do they come back?

  • By
    6 Things You Didn’t Know About Firefox OS

    Firefox OS is all over the tech news and for good reason:  Mozilla's finally given web developers the platform that they need to create apps the way they've been creating them for years -- with CSS, HTML, and JavaScript.  Firefox OS has been rapidly improving...

Incredible Demos

  • By
    Duplicate the jQuery Homepage Tooltips

    The jQuery homepage has a pretty suave tooltip-like effect as seen below: The amount of jQuery required to duplicate this effect is next to nothing;  in fact, there's more CSS than there is jQuery code!  Let's explore how we can duplicate jQuery's tooltip effect. The HTML The overall...

  • By
    Drag. Drop. Lock.

    I've received dozens of emails about my Six Degrees of Kevin Bacon Using MooTools article. The MooTools in my article contained a lot of conditional code to require correct dropping per the game and many people requested that I simplify the process and just...

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!