Notice: Undefined index: order_next_posts in /nas/content/live/gadgetmag/wp-content/plugins/smart-scroll-posts/smart-scroll-posts.php on line 194

Notice: Undefined index: post_link_target in /nas/content/live/gadgetmag/wp-content/plugins/smart-scroll-posts/smart-scroll-posts.php on line 195

Notice: Undefined index: posts_featured_size in /nas/content/live/gadgetmag/wp-content/plugins/smart-scroll-posts/smart-scroll-posts.php on line 196

Take your Linux PC back to the future!

Take your PC back to 1985 with a cool selection of tools and tricks that build a fully functioning desktop computer on the console!

There are many reasons to use the console. Sometimes you need to run on older hardware. Or you may be stuck running remotely over a slow connection, where using an X11 desktop is just painfully slow. There are lots of articles that describe the tools and utilities available for the console.

But how do you use them all together? This tutorial will look at one way that you can combine all of these programs together to give you a fully functional desktop. You’ll essentially end up with a console desktop where you can check email, surf the web, chat with people, catch up on the news, and more. We’ll use tmux to organise your desktop and make the most of your screen real estate.

Email will handled by Mutt; web browsing by ELinks. The great thing is that there are multiple options for many of the tasks you may wish to do. So these should only be taken as examples. You can replace any of these utilities with your favourite versions. You should end up with a desktop that you’d be proud to use in 1985. Note: For easier screen grabbing we took the grabs for this article in X11, running these apps from an xterm window.

Setting up your console
The first step is setting up your console. You can set the colours used by setting escape characters. You can set the fonts you want to use with the command ‘setfont’. In Ubuntu, the fonts available are located in /usr/share/consolefonts. Most simply, you can run ‘setfont fontname’ to set some other font dynamically. If you want to see all of the characters available in the font you selected, you can use ‘showconsole’. When you are ready to set this new font as your default on login, set the environment variable ‘CONSOLE_FONT’ in the file /etc/kbd/config.

Monitoring your machine
One of the classic tools for monitoring your machine is Conky. You can also use Conky on the console. An example configuration would be:

out_to_x no
out_to_console yes
total_run_times 1
${time %H:%M}|free space:${fs_free /}|$loadavg|free mem:$memeasyfree

You could place this in a file called .conkyintmux in your home directory. Then you can tell tmux to use this as its status line with the line:

set-option -g status-right “#(conky -c ~/.conkyintmux)”

in your tmux configuration file.

File management
People who are old enough to remember the days of DOS will likely remember Norton Commander. There is an open source version called Midnight Commander. This utility provides all of the file management tools that you will ever need. By executing ‘mc’, you will have a two-pane display of your file system, and can move, view and edit files at the touch of a key.

Web browsing
Some of the options available include Lynx, w3m, Links, Links2 and ELinks. You can even surf the web using Emacs. Links2 has the added ability to display graphics using the frame buffer or SVGA driver, among many others. It can also handle frames and tables correctly. So, for that reason, we’ll use it here. If you do want to use it in a non-text mode, you will have to switch to a new virtual console (usually by pressing Alt+Fn, where n is a number). You may also need to check into permissions to access the graphics device. A very quick fix if this is an issue is to run Links2 under sudo.

Getting your daily tasks
Many people use Google Calendar to organise their lives. Google has released a console-based tool called gcalcli which allows you to interact with your Google Calendars. There are several options available to add new appointments, or query and display your current appointments in lots of interesting ways. One possibility is to show what your next appointment is in your tmux status line, with:

set-option -g status-interval 60
set-option -g status-left “#[fg-blue,bright]#(gcalcli --user ‘username’ --pw ‘password’ agenda | head -2 | tail -1)#[default]”

This will update every 60 minutes.

Keeping up with news
Many people get their daily dose of news through RSS feeds. The options on the console include Snownews and Canto. Here we’ll use newsbeuter. It has been described as the Mutt of RSS feed readers. The URLs of your feeds are stored in the file ~/.newsbeuter/urls. You can either enter them manually, one per line, or you can import an OPML file that you got from some other news-reading program. You would do this with:

newsbeuter -i import.opml

Once it is up and running, it really does look like Mutt for RSS feeds.

Email, the Mutt way
Mutt is one of the more popular email clients out there. It supports local mail delivery, so you could use something like Fetchmail to go out and collect your email and deliver it locally on your machine. Mutt also supports IMAP connections, so you can use it to check your email directly if you have an external email server. This comes in handy for all the people who use Gmail to handle their email needs. You set it up in the configuration file .muttrc in your home directory. To receive mail, you would set the following options:

set from = “”
set realname = “Your Real Name”
set imap_user=””
set imap_pass=”yourpassword”
set folder=”imaps://”
set spoolfile=”+INBOX”
set postponed=”+[Gmail]/Drafts”
set trash=”imaps://[Gmail]/Trash”
set header_cache=~/.mutt/cache/headers
set message_cachedir=~/.mutt/cache/bodies
set certificate_file=~/.mutt/certificates

You will also need to create the following directories in your home directory:

mkdir ~/.mutt
mkdir ~/.mutt/cache

You can also send your email through the SMTP server at Gmail with Mutt. To do this, you will need to set the following options:

set smtp_url=”smtp://”
set smtp_pass=”yourpassword”

Chatting on the console
There are several chat programs available for the console. The one we’ll look at here is CenterIM. It supports ICQ, Yahoo! chat, AIM, IRC, Jabber, LiveJournal, gadu-gadu and MSN. Configuration can be handled with menus from within the program. It is broken up into a nice set of panels with contacts on the left and your message window on the right. This is all configurable, too.

Twittering on the console
There are a handful of applications that let you tweet from the console. Twidge is one of them. With it, you can check on tweet timelines, send tweets, add and remove users to your follow list, and get a list of recent tweets from those that you follow. You will need to authorise twidge so that it will have access to your Twitter account. Once you do that, you can start interacting through commands. To send a tweet, you would use:

twidge update “Trying out twidge from the console”

Your tweet needs to be no more than 140 characters, and needs to be quoted so that the shell treats it like a single object to hand in to twidge. To check the recent activity, you can simply use:

twidge lsrecent

As a repeating display, you can use:

while true; do twidge lsrecent | head -n 10; sleep 60; clear; done

This will print out the top ten lines of your feed, refreshing every 60 seconds. You can go ahead and change the number of lines and/or the refresh time easily.

Setting up screen estate with tmux
Tmux is kind of like a next-generation GNU Screen. It not only allows you to multiplex a single console, but it also lets you divide your console display into multiple windows. You can interact with tmux by pressing Ctrl+b and a command. For example, to create a new window would require ‘Ctrl+b c’. Each window can be broken down into several panes. You can navigate the windows with ‘Ctrl+b n’ (next window) and ‘Ctrl+b p’ (previous window). You can navigate panes with ‘Ctrl+b o’ (select the next pane in the current window).

The real power comes in the ability to script everything. There is a complete command language available. You can set all of the windows and panes, and all of the applications to be started in each window/pane, in the file .tmux.conf in your home directory.

Scripting tmux
Now we will pull the whole thing together by letting tmux script it all together. One starting point could be:

new -s TmuxDesk “links2”
splitw -t TmuxDesk:0 “centerim”
select-layout tiled
splitw -t TmuxDesk:0 “mutt”
select-layout tiled
splitw -t TmuxDesk “mc”
select-layout tiled
splitw -t TmuxDesk “while true; do twidge lsrecent | head -n 10; sleep 60; clear; done”
select-layout tiled
splitw -t TmuxDesk “newsbeuter”
select-layout tiled
set-option -g status-interval 60
set-option -g status-right ‘#(conky -c ~/.conkyintmux)’