Life on the command line: echo Welcome to Text11
1 Year ago i gave myself a challenge: Can i go a full month without X11? As there is not enough articles on how one may go about this i thought i would start a multi-part series talking about my program choices, How to wire everything together and how to restore some of the functionality that 'goes missing' when moving from traditional GUI environment to a text based one.
My original experiment to go without X11 came out of my desire to push myself as well as rediscover some of the old school programs and workflows that have been left in the dust over time. I was pleasantly surprised to find that i can indeed be quiet productive in a text only environment and not only survive but thrive with such a different setup.
One of the first things one notices when going all text is that font rendering on a Linux VT is horrible. While i do enjoy a pixel heavy text font on occasion i found myself wanting anti-aliased fonts on a day to day basis as well as the ability to adjust font sizes for presentations or for just when i am tired.
The second thing i noticed was how often Unicode characters were used on the internet, from rendering peoples names to rendering navigation elements. It turns out Linux has limited support for rendering these characters but not without limitations.
After looking around i decided to use a framebuffer based terminal emulator, one that could handle utf-8 properly, do 256 colors and render my font(s) of choice at the size i wanted. This left me with 2 choices, kmscon or fbterm after struggling with kmscon due to it requiring a newer build environment than stock Debian provides i decided to go with fbterm with DejaVuSansMono as the font. This gives me a very very nice looking terminal with the option of having a background image if i so chose.
Once you have made your terminal that little bit prettier you are faced with another challenge, "how do i run multiple apps at the same time?". There are multiple options here. While i knew how to use screen, i originally used multiple Virtual Terminals. This was because it made tinkering with fbterm and getting the setup correct alot easier (launching fbterm inside screen causes issues). fbterm also provides its own terminal multiplexing with familiar key bindings however i opted to go with screen run inside a fbterm session as it became useful to attach to screen from another machine over ssh on occasion. For those of you wondering why i don't use tmux, i use daemon processes in my status line and it appears tmux does not support persistent processes that update their own output in the status line. I am looking into it but havent worked out how to replicate this yet.
Ok so now i can run multiple apps in a nice looking terminal, now what? well now i had to decide on how i communicate with the world. I am a heavy Jabber/XMPP user and had been using a console xmpp client called mcabber for awhile so that choice was easy to make (i run one mcabber client per account). how about web browsing? a quick look indicated that there were a couple of options, lynx, links [w3m] and elinks. These were all similar however i found elinks to be the most up to date out of all 4 options.
That takes care of 2 options, next i had to tackle mail. I have been using mutt in a screen session on my VPS for awhile and it was really time i migrated that to run locally and connect via IMAP-SSL. This wasn't too difficult, i did experiment with using offlineimap to sync my mail locally but had issues with my filesystem on /home, as i use NILFS2 and run close to capacity NILFS2 likes to garbage collect a lot and this can cause the disc to fill up temporarily when there is a lot of file creation then clear. For my own personal usage NILFS2 is great as i can rollback files but i would not recommend it in production without knowing how it can bite you badly.
Audio and music was the next thing on my list of decisions and for this i decided to go with pulseaudio. Some people love it, some people hate it. I am in the former category. One feature that made pulseaudio a 'must have' is the ability to stream audio over the network. I frequently ssh into a remote host with a monitor attached and running X11 and play a movie on the attached screen but have the audio piped to my netbook. pulseaudio made this extremely simple to do. As for music this was once again another easy decisions. I have been an avid mpd user for a long time but this gave me an opportunity to try out ncmpcpp instead of ncmpc and i am still glad i made the move. It has a much more comprehensive interface and a familiar interface.
Now that i had working audio i had to decide how to watch movies. While my atom based netbook is no powerhouse it is handy to be able to watch the odd movie. After poking around i found i needed a movie player that supported framebuffer output. This left me with 3 choices, mplayer, xine and a custom gstreamer based solution. I had already been using mplayer for awhile and decided to go with one of its forks, mplayer2 hoping that its multicore and my atoms hyper threading would allow me to watch 720p content. I was wrong in this regard but have still kept mplayer2 around and for those times i want to watch larger files i ssh into a remote host as mentioned in the audio section and use another machine to display and render the video. At some point i still plan to make a movie player for the cmdline based off of gstreamer and python's gstreamer bindings, however for the moment my current setup suffices.
Moving pictures is taken care of but still pictures was still on my list. This is one area where i actually had to do some research, the 4 options i looked at were using imagemagic to convert images and piping that to /dev/fb0, fim, fbi and fbv. After playing with these options there was only one winner. Due to fbterm opening /dev/fb0 only fim seemed to "play nice" with fbterm. It also helped that it is the most feature rich of the 3 and useful not only as an image viewer but also to selectively tag files that could be used in a pipeline (eg manually tagging duplicate files for removal).
While i had always been meaning to set it up, it took Google reader shutting it down to prompt me to start using RSS/Atom. This has turned into a massive productivity boost for me as while elinks does a nice job of rendering pages most of the time some sites are just hard to navigate (eg [reddit]). RSS readers have really cut down the amount of time needed for me to navigate to interesting content. Originally i tried canto-ng but ran into issues with wide support compiled into ncurses and python3. This left one options: newsbeuter. Having a similar interface to mutt was nice and it was easy to add some extra key bindings to make getting through all those articles a little bit easier.
I normally leave a terminal open with ipython running on python3. I find it handy to have something that's a bit more heavy weight than a bash shell session for doing anything from parsing lxml to doing string mangling. At times i have toyed with replacing my default shell with ipython however while it makes python easier to use, It does not make it as easy to use as bash does. I think there is still innovation in this space and that it may be possible one day however for the moment i will be sticking with bash.
Finally it comes down to text editors, i use nano. No apologies here. It does what i want, is available on most systems by default and is good enough. I am currently hitting the edges of its power and may have to migrate to something a bit heavier sooner rather than later however nano has served me well for years.
While i have talked about my program choices here i intend to write another article soon on the 'plumbing' i have on my system to make these programs work together as well as talk about the 'plumbing' in the underlying OS (eg Kerberos and autofs) to make things much easier to use and transparent.