iftop with colours

Recently I was involved in a lot of trouble shooting a complex network flow. Close to 8 iftops keep running on my extended monitors and at time it becomes difficult to differentiate the download and upload bandwidth with one look. So I thought let me top this excellent bandwidth monitor tool from Paul Warren and Chris Lightfoot with colors. here is how it looks.

screenshot of iftop command with colour output
iftop command with colour output

The code is available in github. If you are using ubuntu, you can directly install iftop colour version from this PPA. Basically I have patched on the latest code avaialble for ubuntu 13.10 (Saucy). David Heidelberger has ported it to Gentoo

[Update: 24May2014] updated ppa for ubuntu 14.04 – Trusty Tahr . Git has the latest code.

Check airtel 3g balance on Huawei e303c from Ubuntu linux

To check Airtel 3G balance on huawei e303c ubuntu Linux perform the following steps

  1. Install Gsm-ussd. For ubuntu or debian Linux download the deb and for Redhat or RPM based Linux download the rpm binary.
  2. connect your Huawei E303c 3g modem to the computer. if this is the only modem connected , it will create three usb serial devices named ttyUSB0, ttyUSB1, ttyUSB2. You can verify that by running
    dmesg | grep ttyUSB
  3. Then run the following command from shell.
    sudo gsm-ussd '*123*11#' --no-cleartext -m /dev/ttyUSB2

The output will look like this

Your current 3G Mobile Internet balance for your airtel number are: 1Amt 1421.14 MB&VD Jun 27 2013 ;2Amt 0.00 MB&VD Jun 26 2013.

Issues you might face
For some reason the gsm-ussd tool is not consistent. Sometimes the above command will throw this error even though the Sim is not protected with pin.

ERROR: SIM card is locked, but no PIN to unlock given.
Use "-p "!

However waiting for few seconds and retrying the same command works. Looks like some device lock issue.

Sometimes running this command will disconnect you from internet. And any attempt to reconnect will fail. Sweat not, remove the dongle and connect back and try dialing. It will connect now.

thanks http://askubuntu.com/questions/173750/huawei-e353-ussd-codes-and-message

Tethering Motorola Defy. Internet over USB on Windows and Linux

I purchased Motorola Defy Android mobile phone running Android 2.2.2, ( the later Defy+ runs Android 2.3). the phone supports 3G hotspot over  WIFI. But for some reason my phone kept crashing after few minutes of use of the hot spot feature. So I wanted to setup the tethering over USB. I use Kubuntu and Windows . Here, I wil explain how to tether your Motorola Defy phone using USB. The same should work on DEFY+, though I have not tested on it. Both the approaches doesnot require the phone to be rooted. And I use Airtel 3G in India

Tether on Windows:
Follow the instruction here. https://forums.motorola.com/posts/bc40b2fbdc Its stratigh forward and works for DEFY.

Tether on Linux:
This involves litle bit of tinkering. Follow the instructions in this article http://www.humans-enabled.com/2009/12/how-to-tether-your-verizon-droid-as.html . The original article itself is capable of tethering DEFY. I have altered couple of steps to suit me and am sharing it here.

Step 4:
my rule for DEFY is
SUBSYSTEM==”usb”, SYSFS{“22b8:428c”}==”22b8″, MODE=”0666″,

Step 10:
If you are using DEFY with android 2.2.2 , then don’t bother to download the Azilink with Android 2.3 patch. Download the latest release from the Azilink site itself.
cd ~
mkdir azilink
cd azilink
wget http://azilink.googlecode.com/files/azilink-2.0.2.apk
adb install -r azilink-2.0.2.apk
wget http://azilink.googlecode.com/files/azilink.ovpn

Step 11 & 12:
I had merged steps 11& 12 as follows
vi start_modem

#Type in the text below, then hit ZZ to save
adb forward tcp:41927 tcp:41927
sudo echo “domain lan” > /etc/resolv.conf
sudo echo “search lan” >> /etc/resolv.conf
sudo echo “nameserver” >> /etc/resolv.conf
sudo openvpn –config azilink.ovpn

Follow the rest of the steps from the original article. Azilink About page quotes ” since this program doesnot run as root it cannot forward ICMP-based ping requests. To simulate this all pings are translated internally into UDP pings. Unfortunately, many hosts do not respond to UDP ping requests.” So don’t be surprised if you cannot ping your host but still able to use the internet.

Run Tweetdeck on Linux without Adobe air.

In my recent post , I had cribbed about why Am ditching Tweetdeck for Gwibber. Primarily it’s because am not getting any more Adobe Air updates for Linux. But there is good news. Twitter which acquired  Tweetdeck this year, has released native ( that means no more Adobe Air dependency) versions of the sotftware on Windows and Mac. But no release yet for Linux. Then how can this be a good news. Well , apparently , the Windows native version runs decently well on Linux over Wine. Wine lets you run Windows software on other operating systems.

Here is the instruction to get Tweetdeck 1.0 running on Ubuntu 11.0. For RPM  based ditros like Fedora use yum (appropriately) instead of apt-get.
First upgrade the Wine package to the latest. This is not required , but it is better to always use the latest Wine to get the best performance. AS on date wine-1.3.34 is the latest stable version for Ubuntu 11.10
sudo add-apt-repository ppa:ubuntu-wine/ppa
sudo apt-get update
sudo apt-get install wine

Now, download the latest Tweetdeck from http://www.tweetdeck.com/. It will be a .msi file eg. TweetDeck_1_0.msi
wine msiexec /i TweetDeck_1_0.msi
This will launch the installer. clik on install.
The tweetdeck is ready to be used . You can select it from you GUI or start it in command line as follows.
wine  ~/.wine/drive_c/Program Files/Twitter/TweetDeck/TweetDeck.exe

There are however few quirks.the notification window doesn’t pop up always. Something That I hope Wine will fix  soon.


Compiling latest Gwibber on Ubuntu 11.10

Gwibber is an open source microblogging client for Linux. It brings the most popular social networking web services to your desktop and gives you the ability to control how you communicate. My favourite though was tweetdeck. But after Adobe ditched Air for Linux, Tweetdeck doesn’t look enticing anymore. I had to scout for a viable alternative . After trying lot of alternatives like choqok, hotot, I found Gwibber is the one. At least it had more feature in common with tweetdeck. Hotot has a better UI but it is still in its alpha stage..


I use Ubuntu 11.10 and the default version of Gwibber on it is 3.2.1. I wanted to upgrade that to the latest Gwibber version ( as of date) It’s a pretty simple task and here it is how to do it.


Download the latest Gwibber source code from here https://launchpad.net/gwibber . Replace the version no. with whatever version you downloaded.


tar -xvf gwibber-


cd gwibber-


sudo apt-get install build-essential valac-0.14 intltool libgtk-3-dev libgtk2.0-dev libgnome-menu-dev libnotify-dev libgee-dev libsoup2.4-dev libdee-dev libjson-glib-dev gsettings-desktop-schemas-dev libgtkspell3-dev libunity-dev






make check


sudo make install


gwibber ( this will launch the newly compiled Gwibber)


If you had skipped the sudo apt-get step then ./configure might complain about missing packages like valac or intltool. or sometime you might end up getting 


configure: error: Package requirements (glib-2.0 >= 2.26

                  gobject-2.0 >= 2.26

                  gtk+-3.0 >= 3.2

                  gdk-3.0 >= 3.2


                  gio-unix-2.0 >= 2.26


                  libnotify >= 0.7



                  dee-1.0 >= 0.5.19



                  gsettings-desktop-schemas) were not met:


No package ‘gtk+-3.0’ found

No package ‘gdk-3.0’ found

No package ‘gee-1.0’ found

No package ‘pangocairo’ found

No package ‘dee-1.0’ found

No package ‘gsettings-desktop-schemas’ found


If you still find yourself facing with missing package error, then identify the package as follows


apt-cache search | grep dev


find the appropriate packages from the output and add them to the sudo apt-get list above .