How to integrate vcprompt with bash shell to show git information in Ubuntu

If you are using git in Linux then you might have hit command ‘git status’ to find out in which branch are we currently on, whether there are any changed contents or any uncommitted changes. Wouldn’t be nice if we can get those git information easily so that we need not hit that command frequently. ‘vcprompt’ is the solution here. You can easily integrate vcprompt in bash prompt so that we can see git information from the prompt itself. Lets discuss some steps to integrate vcprompt in bash. I am using Ubuntu 12.10 here. It should also work in other similar Linux variations.

vcprompt is a script to show version control information in the command prompt. This script is written by djl. vcprompt is heavily inspired by Greg Ward’s original implementation in C.

Requirements: Python 2.4 or later

You can check Python version from following command.

python --version

If curl is not installed in your systemm then you have to install curl first.

sudo apt-get install curl

How to do?

Download vcprompt script and make it executable.

sudo curl -sL > ~/bin/vcprompt

sudo chmod 755 ~/bin/vcprompt

Now we have to setup bash to use vcprompt.For this you we need to modify .bashrc file

gedit ~/.bashrc

Copy the following code and paste it in the end of the file.

PS1='n�33[0;34mu@h:�33[0;31mw �33[01;35m $(vcprompt -f '[%b%m%u%a]')�33[00m n> '

Save the file and close the editor. Enter following command.

source ~/.bashrc

Hmm…now you get nice looking prompt. If you are in the git working folder then you will see current branch and other git informations.

Dont forget to check README file of vcprompt for more customization options.


How to add Xampp Control panel GUI in Ubuntu 12.10 (Linux)

When you install XAMPP in Linux, there is no control panel GUI for starting or stopping the Server and other components in default installation. But you can create easily. This short tutorial is for those who want to add XAMPP control panel GUI in Ubuntu 12.10.

How to do?

First you need ‘python-glade2’ for this to work

sudo apt-get install python-glade2

Now open Terminal and create a new file named ‘Xampp.desktop’

sudo gedit ~/Desktop/Xampp.desktop

You will get text editor. Now copy following code and paste it there.

[Desktop Entry]
Name=Xampp Control Panel
Comment=Start or Stop XAMPP
Exec=gksudo python /opt/lampp/share/xampp-control-panel/

If you have installed Xampp for Linux in other than ‘/opt’ folder then change the ‘Exec’ and ‘Icon’ value accordingly.

Change the file permissions so that it can execute.

sudo chmod +x ~/Desktop/Xampp.desktop

There is nice and beautiful Xampp icon in your Desktop. If you double-click that icon XAMPP Control panel will open.