Command-line productivity tools

Finger Work


Read email, use your calendar, and check RSS feeds faster than you can say, "Ooooo, pretty."

By Dmitri Popov

Thanks to applications like Firefox, Thunderbird, and OpenOffice.org, you can do most of your work without leaving the convenience of the graphical environment. But that doesn't mean that point-and-click is the only way to productive daily computing. In fact, there are quite a few command-line productivity tools that you can use to perform many common tasks, such as reading email, keeping track of your appointments, and checking RSS feeds.

Switching to command-line applications might seem like a step backward, but it makes sense for several reasons. The first reason is speed: Even the most advanced command-line tools require only a fraction of the system resources consumed by their graphical equivalents. Also, because command-line applications don't include any visual embellishments, such as buttons and toolbars, they provide a distraction-free work environment and fit small screens better. Efficiency is another important factor. Most command-line applications can be controlled using just a handful of keyboard shortcuts, and once you've mastered them, you can work faster than with any graphical application.

Terminal Emulators

Before you dive into the command-line world, you might want to replace the default terminal with a more flexible tool, such as Tilda for Gnome or Yakuake for KDE [1]. Both utilities are loosely based on the Quake terminal; they run constantly in the background and you can show and hide them using a keyboard shortcut. This seemingly simple mechanism makes a big difference when working with command-line applications. Tilda and Yakuake are available in the repositories of most mainstream Linux distributions, so you can easily install them using your distro's package manager. Both terminal emulators are highly customizable, easily allowing you to tweak their appearance and behavior (Figure 1). Moreover, Tilda and Yakuake support tabbed interfaces, so you can run multiple apps in separate tabs.

Figure 1: A little bit of tweaking makes Tilda look like this.

Text Wrangling with nano

A decent text editor is probably the most important tool in any user's toolbox. Although there are quite a few text editors you can choose from, nano [2] strikes a perfect balance between power and ease of use. Nano is bundled with many popular Linux distros, and you can launch it by running the nano command. All actions in nano are done using keyboard shortcuts, and you can see the most important ones at the bottom of the screen. You can periodically save the file during editing using the Ctrl+O shortcut. To exit nano, press Ctrl+X. If you exit nano from a modified file, it will prompt you to save it first.

Like any text editor worth its salt, nano supports the cut and paste actions. The Ctrl+K shortcut cuts a single line. To paste the line, place the cursor where you want to insert the line and press Ctrl+U. To move multiple lines, cut them using the Ctrl+K shortcut, then paste them all together by pressing Ctrl+U.

If you need to cut a single word or a text fragment, press Ctrl+6 or Alt+A, select the text you want, then press Ctrl+K to cut it. You can then paste the snippet using the Ctrl+U shortcut.

Performing a text search in nano is also easy: Hit Ctrl+W, enter the search string, and press Enter. To find the same string again, press Ctrl+W again and hit Enter. To perform the search and replace action, press Ctrl+\, specify a search string and its replacement, and press Enter. Then you can choose whether you want to replace only the first found match or all occurrences of the search string.

Although nano is not designed to replace a dedicated word processor, it has both word count and spell-checking features, which make it a perfect tool for drafting articles or taking notes (Figure 2). To view the current word count, press the Meta key followed by D. Which key is defined as Meta depends on your system; in most cases it's either the Esc or Windows key. To run a spell check, press Ctrl+T. By default, nano uses its own interactive spell checker that requires the spell program to be installed on your system. Alternatively, you can force nano to use the aspell program instead. To do this, open the nanorc file for editing as root using the nano/etc/nanorc command, and uncomment the following line:

set speller "aspell -x -c"

While you're at it, you might want to tweak other settings, too. For example, if you want to enable the mouse in nano, uncomment the set mouse option. This allows you to use the mouse to place the cursor, set the mark, and execute shortcuts.

Figure 2: Nano supports word count and spell check.

Snownews

If you start your day with checking RSS feeds from your favorite websites, Snownews [3] is for you (Figure 3). This simple yet efficient command-line RSS reader sports a few time-saving features that make it easier to manage multiple RSS feeds. For starters, Snownews can import existing RSS feeds in the OPML format, which can come in rather handy when transferring your RSS subscriptions from another application. To import an OPML file into Snownews, run the following command (where rssfeeds.opml refers to the actual OPML file):

opml2snow rssfeeds.opml >> ~/.snownews/urls

Figure 3: Snownews makes it a breeze to keep tabs on RSS feeds.

Like any other command-line application, Snownews is controlled via keyboard shortcuts, and you can evoke the help screen containing a full list of all available shortcuts along with their brief descriptions by pressing the h key. If you have a few dozen RSS feeds, you can group them using the Categories feature (the C key), which allows you to assign multiple categories to each RSS feed. You can then use the g key to view only the feeds belonging to the currently selected category. Alternatively, you can use the Apply filter command (the f key) to select the category you want. Moreover, you can use the Type Ahead Find feature (the Tab key) to narrow the list of matching RSS feeds as you type.

To open the currently selected feed, press Enter and you can then browse through articles using the p (Previous article) and n (Next article) keys. To view the article you want, press Enter. Finally, you can open the link to the currently viewed RSS article in the default browser by pressing the o key.

Emailing with Alpine

No matter what you do for a living, chances are you spend most of your daily computing receiving, sending, and managing emails; the command-line-based Alpine [4] email client will help you to do that with consummate ease (Figure 4).

Figure 4: You can tweak virtually every aspect of Alpine.

Although this email client is infinitely customizable, getting started with it is very easy - all you have to do is configure an email account.

Because Alpine supports both the POP and IMAP protocols, you can use it with virtually any email service - even with the popular Gmail offering from Google. To do that, launch Alpine and go to Setup | Config. Fill out the fields as follows:

User Domain = gmail.com
SMTP server = smtp.gmail.com:587/tls
Inbox Path = imap.gmail.com/ssl/user=username@gmail.com

Replace the "username" string with your Gmail user name, choose Exit Setup, and save the settings. Alpine boasts a huge number of options that allow you to tweak virtually any aspect of the application. Although you can leave most of the settings at their defaults, you might want to change the way Alpine sorts messages in your Inbox. If you want new messages to appear at the top of the screen, select the Reverse Arrival option in the Sort Key section.

To change the default color scheme, go to Setup, press the K key, and select the color scheme you want (e.g., use-termdef). Then you can scroll down to the GENERAL COLORS section where you can tweak individual colors.

Pygmynote and Calcurse

Need a no-frills command-line task manager? Then you might want to try Pygmynote [5], written by yours truly (Figure 5). The newest version of this simple personal data manager stores all the data in an SQLite database. To make it work on your system, you must install the python-pysqlite2 package first, then you can launch Pygmynote by running the python pygmynote.py command in the terminal. Pygmynote uses a handful of commands to add, modify, and view records, and you can view a list of all commands and their descriptions by using the h command.

Figure 5: Pygmynote is a no-frills personal data manager

If you need a more powerful and flexible tool for managing your tasks and appointments, take a look at Calcurse [6] (Figure 6). This ncurses-based calendaring application provides a rudimentary interface divided into three panels: Appointments, Calendar, and ToDo. The status bar at the bottom provides a quick overview of the available commands, so you should have no trouble getting started with Calcurse even without reading the online help. Adding events and to-dos in calcurse is straightforward. Use the Tab key to focus on the pane you want (e.g., ToDo if you want to add a task) and press the A key. Calcurse lets you specify a priority for each task and time for events. You can also add notes to the events using the N key. Although calcurse can't sync calendaring data directly with other applications or web-based services, it can import and export the data in the iCal format.

Figure 6: Calcurse sports a rudimentary interface and can help you to manage tasks and events.

Final Word

Leaving the colorful world of graphical apps can be a difficult step to take, but adding command-line tools to your toolbox doesn't necessarily mean that you have to abandon your graphical favorites. Because command-line applications are not resource-hungry and don't require a lot of screen real estate, you can load them on your laptop or netbook and use the heavyweight graphical applications on your desktop machine.

INFO
[1] Yakuake: http://yakuake.uv.ro/
[2] Nano: http://www.nano-editor.org/
[3] Snownews: http://kiza.kcore.de/software/snownews/
[4] Alpine: http://www.washington.edu/alpine/
[5] Pygmynote: http://code.google.com/p/pygmynote/
[6] Calcurse: http://culot.org/calcurse/
THE AUTHOR

Dmitri Popov holds a degree in Russian language and computer linguistics. He has been writing exclusively about Linux and open source software for several years, and his articles have appeared in Danish, British, North American, German, and Russian magazines and websites.