In Ubuntu, this is controlled by your theme. If you are running the ubuntu default, then this is metacity / Human. You can find this theme in /usr/share/themes/Human/metacity-1/
.
The actual theme is defined in the metacity-theme-1.xml file.
You can copy this theme to ~/.themes/Human/metacity-1/
and edit the xml file. By editing the normal geometry heights & changing the font, you can cut a lot off, but not down to 2 pixels. Alternatively, If you don't mind changing themes, there is a metacity theme that eliminates the title bars for maximized windows.
If you care to install compiz, you can follow the instructions below to completely remove the title bar according to a rule you define (the link explains how to do it when a window is maximized).
Instructions from google's cache of this site:
You can add a rule to Compiz to hide the titlebar on maximized windows. Here’s how:
Open the compiz config panel (it’s called ccsm; install it if you don’t have it already (sudo apt-get install compizconfig-settings-manager). Go to “Window Decorations”.
The next to last line is “Decoration Windows”. The default is “any”, which means that any window gets decoration.
We want to turn off decoration for maximized windows. So we’re going to replace any with !state=maxvert.
This removes window decorations for windows that are maximized vertically (normal maximization is actually vertical maximization (“maxvert”) and horizontal maximization (“maxhorz”)).
There you have it–your maximized windows don’t have any titlebars. If you need to do anything with them (minimize, close, etc), you can use Alt+space and then hit the hotkey for whatever you want: n=minimize; x=unmaximize; c=close; etc.
There is similar advice on the compiz forum.