Results 1 to 9 of 9

Thread: Tweeting through terminal

  1. #1
    Join Date
    Oct 2009
    Beans
    8

    Tweeting through terminal

    This is a short tutorial explaining how to post to Twitter using command-line in Linux, without needing to even open up your web browser.

    First, install the curl package:

    sudo apt-get install curl

    Next, create a script anywhere in your $PATH, for example twitter.sh inside ~/bin, where ~ is your home directory (make sure ~/bin is included in your $PATHvariable, in case echo $PATH doesn't return it, edit~/.bashrc and add a line like this: export PATH=/home/USER/bin/:$PATH).

    The script twitter.sh should contain the following:

    #!/bin/bash
    curl -u USERASS -d status="$*" http://twitter.com/statuses/update.xml > /dev/null
    echo "Message sent!"

    Replace USER and PASS with your Twitter username and password, and then make the script executable:

    chmod 755 ~/bin/twitter.sh

    And now test it:

    twitter.sh Hello, world! This is a test.

    So just use it as:

    twitter.sh YOUR MESSAGE

    thanks to linuxtree

  2. #2
    Join Date
    May 2009
    Location
    Wao Kele 'O Puna, Ola'a,
    Beans
    143

    Re: Tweeting through terminal

    May I suggest that code which is to be typed into terminal or used in a script be placed within CODE brackets, thus avoiding the "smiley" inclusion?

    As your post reads now, one must decipher the ascii text for the particular smiley which appears within the tutorial in order to actually get what you're trying to relate.

    Great concept!.
    Last edited by Chiapo; January 17th, 2010 at 11:22 PM.
    "640 K should be plenty of RAM for anybody..."

  3. #3
    Join Date
    Jul 2007
    Beans
    17

    Re: Tweeting through terminal

    Cool. Now, how to modify the script so that the tweet shows it originated from "command line"? =)

  4. #4
    Join Date
    Oct 2005
    Location
    Carterville, IL, USA
    Beans
    211
    Distro
    Ubuntu UNR

    Re: Tweeting through terminal

    That's cool. Unfortunately, your USER: and then PASS was interpreted as USER: smiley and then censored. Haha!

  5. #5
    Join Date
    May 2009
    Beans
    16

    Re: Tweeting through terminal

    Works, thanks for the info.
    Last edited by mantorpcity; March 5th, 2010 at 04:53 PM.

  6. #6
    Join Date
    Aug 2007
    Location
    Mumbai
    Beans
    24
    Distro
    Kubuntu

    Re: Tweeting through terminal

    any way to do this after the change in authorisation mechanism at twitter?
    Infinite Diversity in Infinite Combinations

  7. #7
    Join Date
    Apr 2011
    Beans
    2

    Re: Tweeting through terminal

    this doesnt work anymore after OAUTH system... do u have another solution?

  8. #8
    Join Date
    Aug 2007
    Location
    Mumbai
    Beans
    24
    Distro
    Kubuntu

    Re: Tweeting through terminal

    currently I am using 'twidge' which is available in the karmic, maverick and natty repos.
    Infinite Diversity in Infinite Combinations

  9. #9
    Join Date
    Apr 2011
    Beans
    2

    Re: Tweeting through terminal

    i want to learn the way of sending tweet by using bash script? can anyone help about this?

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •