Feeds:
Posts
Comments

Posts Tagged ‘CLI’

It had to happen, an official google application that provides access to google services via the command line. In April we showed you how to do this, the unofficial way using surfraw. Now you can do it with the blessing of the worlds most popular search engine company, Google

GoogleCL can be used to google the following services (examples shown):

  • Blogger
    $ google blogger post –title “foo” “command line posting”
  • Calendar
    $ google calendar add “Lunch with Jim at noon tomorrow”
  • Contacts
    $ google contacts list name,email > contacts.csv
  • Docs
    $ google docs edit –title “Shopping list”
  • Picasa
    $ google picasa create –album “Cat Photos” ~/photos/cats/*.jpg
  • Youtube
    $ google youtube post –category Education killer_robots.avi

Unfortunately, the deb which was released yesterday, doesn’t automatically setup the terminal browser. You will have to do this yourself:

gedit /home/user/.googlecl/config

After running one of the services for the first time, the above config was created. I opened it with gedit and added

auth_browser = w3m

Which is the w3m text-based browser. There are a lot more services on the way, and one can only hope this is a sign of things to come. I can think of a number of Net services which could do with a CLI interface.

( Remember to fill in forms with w3m , to log into your google account, you have to hit the enter key.)

Please check the official development page site for the last update.
Please visit the official download page to download GoogleCL (You’ll find a nice deb there waiting for U8UNTU users!)

THANKS Panoet

Read Full Post »

This is the fastest “safe” fixkey method around, since it does not involve aliasing which strictly speaking should be kept for shortening or modifying commands that you already have in your shell, nor does it update software sources, which can slow down valuable time, especially if you have a lot of them.

1. Create a new file named ‘fixkey’ at ‘/usr/bin’ with your favorite text editor:

sudo gedit /usr/bin/fixkey

Then, paste this code:

#! /bin/bash
echo please input your key
read KEY
apt-key adv –recv-keys –keyserver keyserver.ubuntu.com $KEY

2. Give the file executable privileges with this command:

sudo chmod +x /usr/bin/fixkey

3. Start fixing keys using the command line by typing ‘fixkey’ [wait for prompt] [key]. See example below:

fixkey

please input your key

XXXXXXXXXXX

5. You have just fixed a PPA key via the Linux command line!

Previous threads on this subject can be found here and here.

6. Now to fix the key for the chromium-daily ppa:

fixkey

please input your key

4E5E17B5

For a more inclusive but slower method of updating keys, you might like this script from Dominic Evans, which was first noted here. If you have a lot of keys that need to be updating then I suggest you use it, at least once.

If you like my method, please let me know.

Read Full Post »

[PLEASE SEE Better PPA Fixkey Method the below is for informational purposes only.]

In Fix Software Sources Bad Behaviour we reported two methods for accomplishing the same task of fixing keys. The first, involved manually entering two lines in a terminal. The second involved one entry. Now there is a third faster method. Aliasing.

ICE20.com describes aliasing in BASH this way:

Many of us use certain commands over and over again, or we have preferred combinations of options which we always give to certain commands. We can create shortcuts to these commands by giving them an alias in our ~/.bashrc file. The format is:

alias new_name=’command -options’

There are some examples provided at the above site, but the one we want to create is this:

alias fixkey=’sudo apt-key adv –recv-keys –keyserver keyserver.ubuntu.com’

Which will execute a command string when you type fixkey.

1. All you have to do is backup your ~/.bashrc file

cp .bashrc .bashrc.bak

2. then open it in a text editor

gedit ~/.bashrc

3. Scroll down to the relevant section.

# Alias definitions.
# You may want to put all your additions into a separate file like
# ~/.bash_aliases, instead of adding them here directly.
# See /usr/share/doc/bash-doc/examples in the bash-doc package.

#if [ -f ~/.bash_aliases ]; then
#. ~/.bash_aliases
#fi

4. Uncomment so it looks like this

if [ -f ~/.bash_aliases ]; then
. ~/.bash_aliases
fi

5 Save and exit.

Bash documentation recommends creating a separate file for aliases like this.

6. Create the  ~/.bash_aliases file

gedit ~/.bash_aliases

7. Enter the following code

alias fixkey=’sudo apt-key adv –recv-keys –keyserver keyserver.ubuntu.com’

8. Save and exit.

9. Refresh bash. by either logging out, closing the terminal or entering $ bash

10 To fix an errant key, using fixkey. Open Terminal

fixkey XXXXXXXX

WARNING: I  tried the above first leaving the sudo command out and entering it directly in .bashrc expecting that one should be able to simply sudo fixkey in this instance, but this merely turns up a “command not found” dialogue and so I included sudo  in the command string in order for it to execute. This might not be the case with the .bash_aliases file. Any advice on this would be welcome. please see Better PPA Fixkey Method

NOTE: I don’t recommend going off and aliasing everything you do, as you terminal will quickly begin to resemble a unique creature which might bork when you install a new piece of software with the same command structure. (How exactly does this problem of potential commandline scripting conflict get resolved? For example, the above is substantially similar to the following posting at Commandlinefu. Depending on whether your starting point is the ‘addition’ of a key, or ‘fixing’ a key after the fact. Of course both fixkey and launchpadkey can coexist) Rather, I suggest we share commands at places like Commandlinefu or Ubuntu Forums and see if there is any agreement within the broader Ubuntu Community at what to do about reducing relatively complex or time-consuming CLI tasks into easy to remember, attractive or familiar commands. In fact creating more human, or themed commands using the aliasing capabilities of bash, could be the next frontier. I imagine the day when we will be sharing and exchanging CLI matrices or schemas as easily as trying on a new hat or pair of shoes. If the shoe fits, wear it, if not, give it away. – DRL

SEE Environment Variables

Read Full Post »

Follow

Get every new post delivered to your Inbox.