Setup a fancy development environment ... on a linux system console only

My original goal was to see if I could work as a software developer on a linux system console only for energy efficiency.

This is a normal powertop state on an idle desktop under X:

Unload X, unload a couple of daemons, dim your screen and you can get to that :

But then you miss a lot of stuff, let see how far we can get to compensate those losses

Setup the low level : Fixup your keyboard bindings (facultative)

I use the US international keyboard with dead keys, to enable that (or any other favorite keymap you want):
% sudo vi /etc/conf.d/keymaps
# change keymap to us-acentos
% rc-update add keymaps default
% /etc/init.d/keymaps start

Setup the low level : Framebuffer

For the kernel configuration to run your console on a framebuffer, you will need to dig on google the tutorials as it is really hardware dependent. For me it worked out great with KMS under intel graphics.

Once you have that, force the resolution you are on to the applications by doing this :

% emerge sys-apps/fbset # or equivalent under your distribution
% sudo fbset -s > /etc/fb.modes

Mine looks like this to stay on the mode KMS actually set at boot time:

% cat /etc/fb.modes                                                                                                            
mode "1920x1080"
    geometry 1920 1080 1920 1080 32
    timings 0 0 0 0 0 0 0
    accel true
    rgba 8/16,8/8,8/0,0/0

For the gentoo people, you need to activate the framebuffer support on your applications:

% sudo vi /etc/portage/make.conf # or /etc/make.conf
# and add directfb fbcon to the USE variable
% emerge --keep-going --ask --update --newuse --deep --oneshot -t world
# recompile everything that has changed

You gonna need some extra rights to access the console: add yourself in the console, tty and video groups

% useradd -G console myuser
% useradd -G tty myuser
% useradd -G video myuser

Another annoyance to sort out, tty group has not enough rights on the ttys (if you are on a shared system, check if it is secure to do that). You need to patch udev rules for that, here is my custom addition :

% cat /etc/udev/rules.d/99-tty.rule
SUBSYSTEM=="tty", KERNEL=="tty[0-9]*", GROUP="tty", MODE="0660"
Load a simple app and test your framebuffer :
% emerge media-gfx/fbida
% fbi myimage.png # it should show the given image, it is a simple image viewer

We can enhance a little bit the default console with:

% emerge -av media-fonts/terminus-font # be sure you have the pcf flag set
% vi /etc/conf.d/consolefont
# for example change the font to consolefont="ter-v16b"
% rc-update add consolefont default
% /etc/init.d/consolefont start

Setup the low level : mouse support !

Another permission annoyance to solve first:

You need to add those rights in udev so your normal user can grab the mouse.

% cat /etc/udev/rules.d/99-mouse.rules                                                                                         
SUBSYSTEM=="input", KERNEL=="mouse*|mice|event*", MODE="0660", GROUP="console"

We need gpm:

% sudo vi /etc/portage/make.conf # or /etc/make.conf
# and add gpm to the USE variable
% emerge --keep-going --ask --update --newuse --deep --oneshot -t world
# recompile everything that has changed
% rc-update add gpm default
% /etc/init.d/gpm start

Now a "cursor" should appear on your console and you should be able to copy/paste text from it by left click drag to select and right click to paste.

Setup a decent console emulator

I love my powerlines in vim and zsh. But the standard linux console supports something like 500 characters and no truetype font support !

So we need a decent console with utf-8 support.

The only one I found so far is fbterm. Let's install this.

% emerge app-i18n/fbterm
% fbterm # should work

We need to hack our zshrc/bashrc to force TERM to "fbterm" if we are on the console:

In my .zshrc I put :

if [ $TERM = "linux" ]; then
    export TERM="fbterm"

It should have created a .fbtermrc template for you.
Now you can set it up so it gets your powerline fonts for example

% vi ~/.fbtermrc
font-names=Monaco for Powerline

Note: be sure you use my version of powerline for zsh with this patch in

Now vim should be magnificient too...

Setup a web browser

After a good vim, a developer needs a web browser...

After trying 3 or 4 different ones, I still feel that links2 in directfb mode looks the best

Note : you cannot pile framebuffer applications on the same console so I recommend to switch to another virtual console CTRL-ALT-F2 F3 etc ... so you can keep fbterm on the main one.

% emerge -av www-client/links
% links -g -drivers directfb http://news.ycombinator.com/

To improve the rendering you can tweak the subpixel rendering in Display optimization LCD, RGB (should be the most common, if it doesn't look good, try the other one)

Look at images and pdfs

we already saw fbi from the fbida package to look at images

with fbgs from the same package you can read pdfs

Playing a movie

mplayer is working fine for that it automagically detected everything for me.

Note I still have some tearing.

% mplayer mymovie.mkv

Taking screenshots

% emerge media-gfx/fbgrab

I use it with a timer :

% fbgrab -s 30 /tmp/youpi.png &
% # hurry to prepare your screenshot

Playing doom2 !

% emerge games-fps/prboom
# roam on the internet to find Doom2.wad
% prboom -iwad Doom2.wad


Feel free to contact me if you find other goodies on a simple framebuffer/linux console.