Reimagining the Virtual Desktop

Final Term

By

A new Linux terminal emulator tries to bring the command line into the 21st century and bridge the gap to the graphical user interface.

Terminal emulators have existed as long as the Linux desktop, representing the command line on the desktop. However, although they have been integrated into the desktop with tabs and copy and paste commands, in other ways. they are identical to the command lines of the 1970s. Now Philipp Emanuel Weidmann is hoping to change that with Final Term, a project that provides an enhanced command line that takes full advantage of graphical interfaces.

Weidmann is a graduate of the University of Heidelberg with a major in mathematics and a minor in philosophy. Although he describes himself as “a Java EE developer,” he also has experience in web and application development and database design. Final Term is his first open source project, written in Vala and using the Gtk+ toolkit.

Weidmann’s thoughts about the command line begin with him noting that “one of the classic tenets of the Unix philosophy, usually attributed to Doug McIlroy, is, “Write programs to handle text streams, because that is a universal interface.” However, he adds that, in reality, an unstructured text stream is “everything but a universal interface” and that a command line written today from scratch would probably use some form of structured data.

However, such a rewrite, he acknowledges, is unlikely to happen – over several decades, the command line “has amassed a fundamentally flawed but highly reliable and efficient ecosystem that is likely to rule Unix administration for more decades to come.”

Final Term is an effort to bridge this gap between what Weidmann thinks a command line needs to be and what it is likely to remain: “an xterm-compatible terminal emulator that uses some sophisticated trickery to add a semantic layer on top of the unstructured shell output so that the shell user can move to the 21st century while waiting for his shell to do the same.” Final Term was inspired by Steven Wittens’ TermKit, but Weidmann considers TermKit “too far ahead of its time” to be an option for most users.

Weidmann began Final Term in 2012 as a project in his spare time. In April 2013, he put the project on GitHub. After a month of seeing it be ignored, he tried to create some social media buzz. His effort was so successful that Final Term now has “more than a dozen” contributors. “Some of the most important architectural changes that Final Term has seen since its release, such as porting the build to CMake and making the strings localizable, were done by other people,” he says. “Which is great because I lack experience with the underlying technologies.”

Exploring Final Term

Final Term is currently in pre-alpha release. The general release, according to Weidmann, will add tabs and copy and paste functionality, but in other ways it is advanced and stable, considering its present state, with many of its unique features already implemented and stable.

Source code is available on GitHub, but the easiest way to install Final Term is with the Ubuntu packages on Launchpad. The interface appears designed for Unity, so configuration options are available by right-clicking on the application in the title bar.

Right away, you will notice that you can use the mouse as well as the keyboard to navigate Final Term. However, the best way to begin exploring other features is to watch the video on the project’s front page, then scroll down the page’s list of features. After you type at the command line, the first feature you are likely to notice is that the output at each prompt is collapsed so that only the initial command displays (Figure 1). You can use the arrows on the side of the window to expand or collapse each section of output. It is a simple feature, but one that vastly speeds scanning the previous display.

Figure 1: Final Term gives command prompts a collapsible tree structure for easier scanning.

The next thing you might notice is the smart command completion (Figure 2). Many shells boast this feature, of course; however, what makes Final Term’s implementation powerful is that suggested completions are in a drop-down list that includes all possible completions listed in your history, sorted by probability.

Figure 2: Among Final Term’s features is extensive command completion.

Similarly, Final Term recognizes common features of output, such a file names, URLs, and IP addresses. Right-click on an item in the output, and you are offered a list of possible commands (Figure 3). For example, for a URL, the options include Copy URL to clipboard and Open URL in browser, whereas options for a file include displaying attributes, copying or moving, and opening in an editor.

Figure 3: Final Term recognizes elements such as directories and URLs and suggests appropriate commands for them.

Final Term includes other features, such as the ability to drop down from the top of the desktop and to reflow – that is, to rewrap lines when the window size changes. Other features include choices for key binding and color coding (Figure 4); the selection of colors and themes offer more choices than in other terminals, but otherwise they are fundamentally the same.

Figure 4: Final Term includes many standard configuration choices for terminal emulators.

However, what stands out is the collapsible prompts and the drop-down lists of command completions and command options. Like the Bluefish text editor, these tools remove the drudgery of entering standard or repetitive commands manually while leaving users always able to see what is happening and to control things. This can be a difficult place for an application to position itself, but it often makes for the most efficient tools, and Final Term is no exception. In doing so, it makes itself feel more like a desktop tool than any other terminal emulator I have seen – all without simplifying or hiding input or output from the user.

Ongoing Challenges

“The biggest challenge left in Final Term’s development,” Weidmann says, “is the most basic feature of any terminal emulator: interpreting the xterm control sequences.” He explains that most Gtk terminals are built on top of VTE, which simplifies their development. However, because Final Term includes (or plans to include) some unique features, “it must indeed reinvent the wheel in many ways.”

To some extent, working with free software helps the project. In fact, according to Weidmann, “without access to the source code of other terminal emulators, writing a new one would be downright unthinkable.”

Even so, code borrowing is rarely an option. “It doesn’t help that most terminals that have been in development for a while have grown into unmaintainable monstrosities,” Weidmann says. “Even simple terminals commonly have 10 times as many lines of code as Final Term has right now.”

Weidmann blames this bloat on the C programming language that many terminals use, “which makes it hard to build a proper model of anything.” He hopes to do better with Vala, which, while “far from perfect, allows for much cleaner separation of concerns and a solid foundation that will enable easy maintenance and extensibility in the future.”

As with many projects, Final Term’s roadmap is vague. Weidmann hopes for at least a beta release some time in 2013 and to be ready for distributions in 2014. An OS X port is also being done, while queries from early adopters suggest that a Qt port might be more or less inevitable.

Asked about Final Term’s intended audience, Weidmann’s first response is “Definitely everyone!?” He continues: “Final Term can act as a nice learning environment for command-line neophytes, but even greater is the impact it can have on a power user’s productivity and speed. Autocompletion in particular accelerates finding the desired command enormously and usually reduces it to typing one or two letters, the down arrow, and enter.” Indeed, Final Term’s eventual (though not exactly humble) goal is to make obsolete all other terminal emulators in use today and become the default terminal in the majority of Linux distributions (at least those based on Gtk+).

Judging from some of the grumblings, Final Term may face a hard sell appealing to some long-time Linux users. “Too much reliance on graphical elements and the mouse,” one commented. “Curses and keyboard only or it doesn’t happen.”

For new users or those less confirmed in their habits, though, Final Term just might be the application that proves the continued relevance of the command line. Its development and degree of acceptance should be interesting to track in the next year or so.

Related content

  • Chob

    If you are looking for an application in AppImage, Flatpak, or Snap app stores, Chob lets you perform a keyword-based search from the command line.

  • Mrxvt

    Tired of too many terminal windows? Mrxvt is a tab-based terminal tool that lets you manage several sessions in a single window.

  • Command Line – Tilix

    A terminal emulator with innovative features makes working from the command line easier and more efficient.

  • Tutorials – Systemd

    Take control of the services running on your Linux machine

  • Recoll

    Whether you’re looking for a letter to the Internal Revenue Service or an email from an online trader, the Recoll desktop search machine will help you find it with just a few mouse clicks.

comments powered by Disqus
Subscribe to our Linux Newsletters
Find Linux and Open Source Jobs
Subscribe to our ADMIN Newsletters

Support Our Work

Linux Magazine content is made possible with support from readers like you. Please consider contributing when you’ve found an article to be beneficial.

Learn More

News