The Maker Cupboard

- Digital Making - Raspberry Pi Projects - 3D printing - Educational Resources -

Sending a tweet from the command line

Fancy sending a tweet from the command line on the Raspberry PI?

I found a really good script at which guides you through both the code for the script and the other configurations needed to send command line tweets.

I am always very reluctant to include other people’s code without referencing it so check out for the full code and details.

1. You will need a free account at, you will need to make a note of the password as this will be used in the script.

2. Copy this code into a new document using nano ca
lled tweet

#! /bin/bash

# tweet
# This script sends tweets
# Use:
# tweet "String to be tweeted"
# Special characters may not be used if your string is not delimited by quotes
# Author: San Bergmans

# Configuration variables

# Other variables
TWEET=$(echo "$*"|cut -c -140)

curl -u $TWIT_USER:$TWIT_SECRET -d "status=$TWEET" $TWIT_URL -s > /dev/null

Use the command chmod u+x tweet to make it an executable binary and make sure it saved in /bin

Send a tweet using tweet “this is a tweet”