I'm a fan of Konsole and GNOME Terminal, and I use them both regularly. They're great projects, and they represent modern terminals that meet the needs of users who spend their day in a shell, as well as users who only dip into a Unix shell every now and again. They integrate nicely into a desktop environment, bridging the gap between common GUI tasks and common shell tasks. I use GNOME Terminal at work and Konsole at home, and I enjoy them both. However, after being introduced to the rxvt-unicode terminal, its simplicity, portability, and extensibility have kept me a user since I started using it with Slackware Linux 12.
Here's why, and more importantly, how I use rxvt as my default terminal.
It's lightweight
One of my personal budgeting tricks (and contributions to the environmentally friendly idea of repair and reuse) is to never buy new hardware, rather to "rescue" a perfectly usable computer for my personal laptop. (My personal laptop was an "upcycled" 2004 iBook running Debian Linux until its screen became irreparable in 2017.) One of the distinct advantages of open source is that you can run all the latest requisite software, with all the latest security patches, using lightweight applications. These applications, the desktop itself included, barely touch precious system resources that are typically limited on aging computers. The rxvt terminal is relatively tiny; a little heftier than xterm but a lot less demanding than GNOME Terminal and Konsole.
It's distinct
A simple terminal helps separate desktop functions (like drag-and-drop, which rxvt does not provide) from terminal functions (things you can do, for instance, over SSH). Users new to working on remote systems can get confused about what the terminal represents, especially when it's so nicely integrated into the rest of their computers. Sometimes, maintaining a distinct separation between the local environment and remote systems is useful. Of course, this isn't at all by intention; it's arguably a shortcoming of rxvt and similar simple terminal emulators that they don't accept drag-and-drop actions or provide fancy contextual menus (more on that later), but it can be a surprising benefit.
Furthermore, learning a simple terminal interface forces you to expand what you think of as a usable interface. Once you've learned to use rxvt effectively, you might find that Eshell and xterm and even the humble TTY interface serve their purpose. You learn to use low-spec terminals because your idea of what a terminal needs and what's only nice to have has shifted toward simplicity.
Installing rxvt
The fork of rxvt I recommend is usually called rxvt-unicode in software repositories, and it may provide a launcher called URxvt or similar. It's a small application and doesn't require much to build from source code, but most Linux distributions provide it, so it can be installed with your package manager.
On Fedora, CentOS, or RHEL:
$ sudo dnf install rxvt-unicode
On Debian and Ubuntu:
$ sudo apt install rxvt-unicode
On others, such as Slackware, rxvt may already be included.
The default rxvt interface is (deceptively) simple and rather plain.
You might be used to adjusting your interfaces using a Preferences panel on GNOME Terminal or Konsole, but for rxvt, you make changes in a text file.
Customizing rxvt
One of the beauties of rxvt is its plain-text configuration file containing xrdb properties. The xrdb subsystem is the X server resource database utility, which manages user preferences for X11 applications. It's customary to place your preferences in a file called ~/.Xdefaults and then to merge those preferences into the xrdb database.
The easiest customization is basic colors. To see what colors and other properties you can define in rxvt, refer to the man page:
$ man urxvt
For customizing your windows' appearance, the man page identifies the prefix URxvt followed by colors 0 through 15. Using hex codes from any Linux color picker, you can set your own tone for each ANSI color. Here's a solarized theme, with comments:
! solarized theme
! foreground/background
! black
URxvt.color0 : #000000
URxvt.color8 : #555555
! red
URxvt.color1 : #AA0000
URxvt.color9 : #FF5555
! green
URxvt.color2 : #00AA00
URxvt.color10 : #55FF55
! yellow
URxvt.color3 : #AB4400
URxvt.color11 : #FFFF44
! blue
URxvt.color4 : #0000AA
URxvt.color12 : #5555FF
! magenta
URxvt.color5 : #AA00AA
URxvt.color13 : #FF55FF
! cyan
URxvt.color6 : #00AAAA
URxvt.color14 : #55FFFF
! white
URxvt.color7 : #AAAAAA
URxvt.color15 : #FFFFFF
With so many colors for your text, you may prefer a dark background. With rxvt-unicode, you can even set a partially transparent background with some percentage of opacity (100 being fully opaque and 0 being invisible).
URxvt*background: [90]#000000
URxvt*depth: 32
URxvt*foreground: #FFFFFF
You can also set the text to any font you have installed on your system. For instance, to set your font to Fantasque Sans Mono at 21 points:
URxvt*font: xft:FantasqueSansMono-Regular:pixelsize=21:antialias=true
URxvt*boldFont: xft:FantasqueSansMono-Bold:pixelsize=21:antialias=true
URxvt*italicFont: xft:FantasqueSansMono-Italic:pixelsize=21:antialias=true
URxvt*letterSpace: -1
To implement changes in .Xdefaults, run the xrdb command:
$ xrdb -merge .Xdefaults
Then relaunch xrvt. Here are the results (notice that my desktop's wallpaper shows through slightly):
You can also customize the scrollbar appearance:
! scrollbar style - rxvt (default),
! plain (compact), NeXT, or xtermn
URxvt.scrollstyle: plain
URxvt.scrollBar_right: True
There are many more options available, listed in the rxvt manual, so try the ones that appeal to you. To see all URxvt. properties, type:
urxvt --help
Popup menus and other modern conveniences
As you try rxvt, you may notice that it doesn't support certain modern conventions, such as Ctrl+C to copy, Ctrl+V to paste, dragging-and-dropping, a right-click contextual menu, and so on. However, things are not necessarily as they seem: rxvt has a rich set of features; they're simply "hidden" (from a modern point of view, at least) in a paradigm you may not be used to.
Copy and paste
When you want to copy and paste, there are a few different ways to do it. The "obvious" way to an experienced Linux user is with the X Window System trick of clicking the middle mouse button to paste the contents of your primary clipboard. However, rxvt provides more than just that: press and hold Ctrl+Right Mouse Button over a selection in rxvt, and a contextual menu appears with options for copying and pasting. Once the menu appears, you may release the Ctrl key, but you must keep the right mouse button pressed until you make your selection.
Convert newlines to spaces
Sometimes you type out a function or loop in your shell, or you copy one from a website, but then you decide you need to edit it before running it. The problem is, a command with line breaks in it is notated with > characters:
$ for i in {0..12}; do
> echo $i
> done
$
When you paste that into your terminal, new > characters are inserted at each newline character, resulting in this:
$ for i in {0..12}; do
> > echo $i
> > done
$
You can edit them out, but it's a little cumbersome to work across lines in a terminal because it uses the up and down arrows to cycle through your history. You could run the command and then cycle back up to it in history, which converts multi-line commands to one line, but you don't always want to run a command so you can edit it.
When pasting something from a website, you may run into a related problem: a sequence of commands may not have > symbols, but they probably have embedded newline characters that, when pasted, prompt your terminal to run the command immediately.
A nice bonus feature in rxvt is the newline to spaces option in the Selection menu. This edits the contents of your clipboard so that newline characters become spaces, meaning that a code block is reduced down to one easily editable line when you paste it into rxvt. Commands you're pasting in from a website lose any embedded newline characters, so they don't automatically execute after you paste them in. This does not convert > characters to spaces, so you'll still have to edit those out if they're there, but that is a lot easier with everything on one line:
$ for i in {0..12}; do > echo $i > done
The newlines to spaces feature is one of those minor features I use all the time because I'm almost always leaving notes to myself in folders about which command needs to be run to accomplish some irregular task that I only do on occasion. Inevitably, I end up wanting to modify the command when I rerun it, so it's nice to be able to ensure that the command is easy to edit before I execute it. This feature alone may be the real reason I've stayed with rxvt all these years.
Settings menu
For quick access to common terminal settings options, press Ctrl+Middle Mouse Button to toggle the Options menu on and off. This menu lets you set whether your cursor blinks, if the terminal uses a visual bell, and many other preferences that can be set in your .Xdefaults file. Unlike the Selection menu, this menu persists as a floating menu until you press Ctrl+Middle Mouse Button again.
Launch cheats
Another great feature of rxvt is that it can be quickly customized at launch time with command options. I use this any time I know I'm going to spend a lot of time in an SSH session to a remote host, because I want it to be abundantly clear which terminal contains which session (there's nothing worse than a sudo poweroff command issued to the production server instead of the dev server). Regardless of how you've themed your default rxvt, you can launch an rxvt terminal with any variety of foreground, background, and cursor colors (-fg, -bg, and -cr, respectively). You can also add a border for added emphasis:
$ urxvt -fg green -cr green -bd green &
I tend to keep things simple: I use red for a production server, green for a development server, and yellow for a test or some other remote system.
There are many options you can use to override your defaults at launch. To see them all, refer to the rxvt manual.
Tabs
The rxvt terminal is extensible through Perl. Whether or not you know Perl is largely irrelevant, because many of the features provided by Perl are already bundled with rxvt in /usr/lib64/urxvt/perl/.
One of my favorite extensions is the tabbed interface, which is a relatively modern convention of terminal emulators that nobody should have to do without—rxvt users included. To activate the tabbed interface in rxvt, open ~/.Xdefaults and add these configuration lines:
!TABS
URxvt.perl-ext-common : default,tabbed
URxvt.tabbed.tabbar-fg: 2
URxvt.tabbed.tabbar-bg: 0
URxvt.tabbed.tab-fg: 3
URxvt.tabbed.tab-bg: 0
Merge your configuration with xrdb and then relaunch rxvt.
After relaunching, you have a tab index at the top of your terminal. The default entries are [NEW] and 1. These entries are clickable. You can click the [NEW] entry to open a new tab, and you can click on a number to switch to that tab.
You can also interact with your tabs using the keyboard:
- Shift+Down Arrow opens a new tab
- Shift+Left Arrow activates the previous tab
- Shift+Right Arrow activates the next tab
- Ctrl+Left Arrow moves the current tab to the left
- Ctrl+Right Arrow moves the current tab to the right
- Ctrl+D closes the current tab
There are many more Perl extensions that you can and should try. For instance, the Kuake extension shows and hides your rxvt terminal at the press of a global hotkey (Ctrl+F10 by default).
Click navigation
Most terminals don't act very much like text editors, even though that's pretty much what they look like. For instance, if you start a command such as echo ello and then decide that you meant to type hello, you can't just click on the e to send your cursor there for a quick edit. Instead, you have to press the Left Arrow key four times, or maybe you know the shortcut Alt+B to back up one string. The rxvt terminal changes that.
In rxvt, you can press Shift+Left Mouse Button to reposition your cursor anywhere on the same line of a command you're typing. The way rxvt accomplishes this is by calculating and then issuing the number of cursor-left or cursor-right keypresses required for the cursor to change its location. The result is an experience familiar to anyone who's ever used any text editor, and it's a small and quick convenience that you'll come to appreciate even if you don't use it all the time (after all, it does require your fingers to move away from your keys).
Features, features, features
There are more features in rxvt than the ones listed here. The way to find them is to use rxvt as your terminal and look for ways to solve the things that annoy you about working in a terminal or working with an old "out-dated" one like rxvt. You'll be surprised at what you find.
6 Comments