A Twitter Command for Your Terminal

Write tutorials and howtos in here
There are more tutorials here http://community.linuxmint.com/tutorial/welcome
Forum rules
Do not start a support topic here please. Before you post please read this

A Twitter Command for Your Terminal

Postby finux on Sun Mar 30, 2008 4:44 am

Hi Guys, not too sure if any of you use twitter, but here's a terminal command so you can post directly to twitter from your command line or by pressing ALT+F2 and typing twitter "message" in the Run Application Box. If someone finds a use for it i'll be glad

A Twitter Command for Your Terminal

Well Twitter seems to be getting popular now, and it's pretty we documented that it can be used via the command line terminal if CURL is installed. The below is how to make a twitter command for your terminal. You will obviously need to have a Twitter account registered, and you can do that by going to this web address https://twitter.com/signup

The first thing to do is to install curl if it isn't already installed

sudo aptitude install curl

The we need to make a file which we will make executable, and store it in /usr/bin
I have used gedit but you can use any text editor you choose

sudo gedit /usr/bin/twitter

and place the following code into the newly formed file

curl --basic --user "yourusername:yourpasswd" --data-ascii "status=`echo $@|tr ' ' '+'`" "http://twitter.com/statuses/update.json" -o /dev/null
echo Message Sent!

You will need to replace "yourusername:yourpasswd" with your twitter username and password, save the file, and exit the test editor.

Then you will need to make the file executable by placing the following code into the command line terminal

sudo chmod +x /usr/bin/twitter

To use the newly created command you can type

twitter WHATEVER YOU WANT TO POST TO TWITTER

if your using a gnome desktop, you can press ALT+F2 and in the Run Command Box that appears type

twitter WHATEVER YOU WANT TO POST TO TWITTER

Most of the above was taken from this web site http://www.ubuntu-unleashed.com/2008/03 ... ne-in.html

and all though it was used for Ubuntu it should work on nearly all distributions, remember if you change your Twitter password then you'll need to update you /usr/bin/twitter file.

I've been contacted by a few people and i have seen it myself, some messages seem to be problematic, if you have issues then try putting your text in quotes, example below

twitter "INSERT TEXT BETWEEN THE QUOTES"

// side note after writing this guide

I've noticed and it's been raised by one or two people. The script sometimes play's up, if it does try using it by putting the text between quotes like

twitter "TEXT BETWEEN QUOTES"

Finux can be found @

http://www.thelinuxsociety.org.uk

http://www.twitter.com/f1nux

irc freenode #linuxbasement
finux
Level 1
Level 1
 
Posts: 23
Joined: Sat Feb 24, 2007 2:29 pm
Location: Dundee, Scotland, United Kingdom

Linux Mint is funded by ads and donations.
 

Re: A Twitter Command for Your Terminal

Postby Husse on Mon Mar 31, 2008 7:06 am

Thanks for this
Had not heard of Twitter before.....
Image
Don't fix it if it ain't broken, don't break it if you can't fix it
Husse
Level 21
Level 21
 
Posts: 19717
Joined: Sun Feb 11, 2007 7:22 am
Location: Near Borås Sweden

Re: A Twitter Command for Your Terminal

Postby finux on Mon Mar 31, 2008 9:14 am

no problems, glad you liked it
finux
Level 1
Level 1
 
Posts: 23
Joined: Sat Feb 24, 2007 2:29 pm
Location: Dundee, Scotland, United Kingdom

Re: A Twitter Command for Your Terminal

Postby BlahBlah_X on Mon Mar 31, 2008 9:04 pm

I have the strange feeling that you took this from fsckin.com without credit.

Oh wait, it is the exact same, word for word, until the last bit.

Cmon man, give some credit.
User avatar
BlahBlah_X
Level 4
Level 4
 
Posts: 283
Joined: Thu Apr 05, 2007 5:27 pm
Location: Walrus Teeth

Re: A Twitter Command for Your Terminal

Postby finux on Tue Apr 01, 2008 5:05 am

BlahBlah_X wrote:I have the strange feeling that you took this from fsckin.com without credit.

Oh wait, it is the exact same, word for word, until the last bit.

Cmon man, give some credit.


Dude if you read you will find that i said "Most of the above was taken from this web site http://www.ubuntu-unleashed.com/2008/03 ... ne-in.html"

Some come on man, read a bit before you start saying stuff.

// after re-reading the post i went to check on http://www.fsckin.com couldn't find any guide like my one, could you post the link. I must say though he has some nice twitter resources over there, and if you do run linux and twitter that's a great site. I'll be sharing it with everyone on twitter. Getting a little peeved that people don't read what's in a post before making wild comments. An like i say i paid credit to the original author of the Twitter Console Command (Ubuntu Unleashed) quite clear, but obviously not clear enough for BlahBlah_X.
finux
Level 1
Level 1
 
Posts: 23
Joined: Sat Feb 24, 2007 2:29 pm
Location: Dundee, Scotland, United Kingdom

Re: A Twitter Command for Your Terminal

Postby finux on Tue Apr 01, 2008 6:01 am

also Chad at the Linux Basement was saying that Ubunut/Mint supports /home/$USER/bin

so this seems a great place to put your own personal commands in rather than /usr/bin put i suppose if more than one person uses the system they'll not benefit from the commands you put in there, i'm the only person on my machine and i have a separate home partition so i'll be putting every thing in there from now on, and then when i change distro or reinstall my personal commands will still be safe. http://www.linuxbasement.com

Thought i'd share, i'm sure most people knew that anyway, but like i say if you find it useful i'm glad
finux
Level 1
Level 1
 
Posts: 23
Joined: Sat Feb 24, 2007 2:29 pm
Location: Dundee, Scotland, United Kingdom

Re: A Twitter Command for Your Terminal

Postby Husse on Tue Apr 01, 2008 2:12 pm

Perhaps
http://www.ubuntu-unleashed.com/2008/03 ... ne-in.html
does not give credit to fsckin....
It seems so
Image
Don't fix it if it ain't broken, don't break it if you can't fix it
Husse
Level 21
Level 21
 
Posts: 19717
Joined: Sun Feb 11, 2007 7:22 am
Location: Near Borås Sweden

Re: A Twitter Command for Your Terminal

Postby finux on Tue Apr 01, 2008 2:50 pm

Husse wrote:Perhaps
http://www.ubuntu-unleashed.com/2008/03 ... ne-in.html
does not give credit to fsckin....
It seems so


Can't seem to find any thinking similar to the guides on http://www.fsckin.com/ However the dude has some nice stuff on there, posted his link to a couple of sites, and stumble'd and digg's it too.
finux
Level 1
Level 1
 
Posts: 23
Joined: Sat Feb 24, 2007 2:29 pm
Location: Dundee, Scotland, United Kingdom

Re: A Twitter Command for Your Terminal

Postby Husse on Tue Apr 01, 2008 5:20 pm

At least I found
curl --basic --user "yourusername:yourpasswd" --data-ascii "status=`echo $@|tr ' ' '+'`" "http://twitter.com/statuses/update.json" -o /dev/null

Did not look for more, lets leave it you've at least given credit to someone :)
Image
Don't fix it if it ain't broken, don't break it if you can't fix it
Husse
Level 21
Level 21
 
Posts: 19717
Joined: Sun Feb 11, 2007 7:22 am
Location: Near Borås Sweden

Re: A Twitter Command for Your Terminal

Postby BlahBlah_X on Tue Apr 01, 2008 7:52 pm

finux wrote:
BlahBlah_X wrote:I have the strange feeling that you took this from fsckin.com without credit.

Oh wait, it is the exact same, word for word, until the last bit.

Cmon man, give some credit.


Dude if you read you will find that i said "Most of the above was taken from this web site"

Some come on man, read a bit before you start saying stuff.

// after re-reading the post i went to check on http://www.fsckin.com couldn't find any guide like my one, could you post the link. I must say though he has some nice twitter resources over there, and if you do run linux and twitter that's a great site. I'll be sharing it with everyone on twitter. Getting a little peeved that people don't read what's in a post before making wild comments. An like i say i paid credit to the original author of the Twitter Console Command (Ubuntu Unleashed) quite clear, but obviously not clear enough for BlahBlah_X.



http://www.fsckin.com/2008/03/19/twitte ... mand-line/

There. Oh wait, the post on ubuntu unleashed was made two days after the one on fsckin. Hmmm, did the ubuntu unleashed one give credit? Because they are very similar.
User avatar
BlahBlah_X
Level 4
Level 4
 
Posts: 283
Joined: Thu Apr 05, 2007 5:27 pm
Location: Walrus Teeth

Re: A Twitter Command for Your Terminal

Postby newW2 on Tue Apr 01, 2008 9:43 pm

I went there (fsckin) viewed the video and got "Rick-Rolled" LoL!
User avatar
newW2
Level 6
Level 6
 
Posts: 1081
Joined: Fri Apr 06, 2007 10:24 am
Location: USA

Re: A Twitter Command for Your Terminal

Postby finux on Wed Apr 02, 2008 5:32 am

newW2 wrote:I went there (fsckin) viewed the video and got "Rick-Rolled" LoL!


Oh dear, i've already been Rick-Rolled once this week, and that was enough. This one was a killer, don't click it unless you want to be rick rolled http://blog.dweezel.info/
finux
Level 1
Level 1
 
Posts: 23
Joined: Sat Feb 24, 2007 2:29 pm
Location: Dundee, Scotland, United Kingdom

Re: A Twitter Command for Your Terminal

Postby xtremyst on Sat Nov 19, 2011 8:35 am

i followed the instructions but while opening the /usr/bin/twitter with gedit
i get this message on terminal:

Code: Select all
(gedit:3190): Gtk-WARNING **: Attempting to store changes into `/root/.local/share/recently-used.xbel', but failed: Failed to create file '/root/.local/share/recently-used.xbel.TK6X4V': No such file or directory


and when i tried to save the file:
Code: Select all
Gtk-WARNING **: Attempting to store changes into `/root/.local/share/recently-used.xbel', but failed: Failed to create file '/root/.local/share/recently-used.xbel.TD904V': No such file or directory



anyway i kept going, finally tried to twitter (with and without the quotes)
i get this message:
Code: Select all
% Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100   140  100    74  100    66     54     49  0:00:01  0:00:01 --:--:--   103
Message Sent!


but when visiting twitter with my web browser i cant find the message i sent

anyone knows whats wrong?
xtremyst
Level 1
Level 1
 
Posts: 1
Joined: Mon Oct 31, 2011 4:05 am

Linux Mint is funded by ads and donations.
 

Return to Tutorials / Howtos

Who is online

Users browsing this forum: No registered users and 7 guests