Archive for the ‘Ubuntu’ category

How to install Android Debug Bridge (ADB) on Linux.

July 18th, 2010

The Android Debug Bridge (ADB) is a client-server application designed to manage the state of an Android Powered Device.

To install it in Linux, we have to get the Android SDK. We can do that by going to http://developer.android.com/sdk/index.html and downloading the Linux version, by the time I wrote this was: android-sdk_r06-linux_86.tgz

And so I did:

wget http://dl.google.com/android/android-sdk_r06-linux_86.tgz

Now we need to decompress the archive, we downloaded:

tar -zxvf android-sdk_r06-linux_86.tgz

Copy everything to /usr/bin so it can be used.

sudo cp android-sdk-linux_86/tools/adb /usr/bin

And as a final step, we need to chmod it, in order to make it executable.

sudo chmod +x /usr/bin

The usage is simple, but I must note that adb must be executed as root, otherwise it will not see the device properly. Here-s an example, how to start it:


adb start-server
adb devices

If the installation went OK you should se something like:


List of devices attached
570071758f58	device
List of devices attached 570071758f58	device

If you have any questions please leave a comment. Hope you enjoyed my tutorial.

How to get the current external IP from Linux.

July 17th, 2010

Here’s my code snippet for getting the current external IP address.

Method 1 (using curl):

This one requires curl to be installed.


curl -s  http://checkip.dyndns.org | grep -o '[0-9]\{1,3\}\.[0-9]\{1,3\}\.[0-9]\{1,3\}\.[0-9]\{1,3\}'

Method 2 (using wget):


wget -q -O- http://checkip.dyndns.org | grep -o '[0-9]\{1,3\}\.[0-9]\{1,3\}\.[0-9]\{1,3\}\.[0-9]\{1,3\}'

I recommend the second because it should work on any system.

Of course you can replace Dyndns with any “IP get” page like http://whatismyip.com.