How to colorize bash prompt easily

posted by Arkham on June 24th, 2009


Sometimes, the bash prompt can look a little dull and it may become difficult to recognize where the output of a command ends. Here I provide with a very simple way to customize your bash prompt by adding some colors.

First of all, add these colors definition to your .bashrc

## Fancy colors
NC='\[\e[0m\]' # No Color

The variables you want to use are

  • \u – username
  • \h – host name
  • \w – current absolute path
  • \W for current relative path
  • \$ – te prompt character (eg. ‘#’)

For example, my current setup looks like:

PS1="${green}\u${NC}@${green}\h ${BLUE}\w${NC} ${GREEN}\$ ${NC} "

Enjoy ;)

Tags: , , ,

Free your memory on Linux

posted by Arkham on December 19th, 2008


No, this is not a howto to make your RAM Stallman-compliant.

Sometimes, it is handy to empty your caches, like when Virtualbox checks the available memory before actually starting. From linux 2.6.16 there are some nice tricks for dropping the memory cache, dentries and inodes.

First of all, we need to free all the cached objects.
Run as root:


Then, to free pagecache:

echo 1 > /proc/sys/vm/drop_caches

To free dentries and inodes:

echo 2 > /proc/sys/vm/drop_caches

To free pagecache, dentries and inodes:

echo 3 > /proc/sys/vm/drop_caches

Now, check your available memory using free and all your cache are belong to us.. *hu-uhm* ..should have been freed. Freed as in freed-om ;)

Tags: ,

Installing Python 3 on Mac OS X Leopard

posted by Arkham on December 6th, 2008


It’s a long time (almost a month!) I don’t write here anymore, but I’ve come back to teach you how to install Python 3.0 with readline support on Mac OS X 10.5 “Leopard” (incidentally I bought a Macbook :P )

  1. Download the latest readline from the GNU readline homepage.
  2. Extract it in a folder.
  3. Download all the patches available here and save them in the same folder.
  4. Open Terminal and enter in that folder.
  5. Apply all the patches by running:
    patch -p0 < patch_file_name

    For example:

    patch -p0 < readline52-001
    patch -p0 < readline52-002
    patch -p0 < readline52-003
  6. Configure, make and install:
    make && sudo make install
  7. Download the latest Python 3 release from here.
  8. Extract it and navigate to the folder with Terminal.
  9. Configure it by running:
    ./configure --enable-framework --with-readline-dir=/usr/local
  10. Compile and install it:
    make && sudo make frameworkinstall

Here you go! :D

Tags: , , ,

KDE-like bigger icons for Gnome menu

posted by Arkham on October 23rd, 2008

I’ve tried to use some kind of KDE like, bigger icons on my desktop for a while and I realized that it is really a pity to not use the wonderful 32×32 tango icons for the gnome menu also. If you want to try, it’s very simple:

gedit ~/.gtkrc-2.0

and put in this line:

gtk-icon-sizes = "panel-menu=32,32"

and restart gnome-panel (maybe you could be more gracious :P):

killall gnome-panel

Here is the outcome:

Tags: , ,

Open sopcast links on Linux

posted by Arkham on October 18th, 2008

SopCast is a simple, free way to broadcast video and audio or watch videos and listen to radio on the Internet. To install it:

$ yaourt -S sopcast

Now go to and find a sopcast link for the event you want to watch.

$ SOPLINK=sop://
$ /usr/bin/sp-sc $SOPLINK 3908 8908 > /dev/null &
$ mplayer

Ta da!


Tags: ,