FUN WITH LINUX

The Rule Of Three (Part 1)

28 September 2015

A sysadmin needs his tools. I really need at least 3 tools to be productive:

  • Terminal-Emulator (or screen/tmux if I am working without X)
  • Shell
  • Editor

This is my Rule Of Three. Those 3 tools can make my life much easier. Therefore I have to choose those tools wisely. And of course I have to know them very well, so I can get all the benefits of them. In this article I want to introduce my favourite terminal emulator: urxvt

I expect some things of my terminal emulator:

  1. It should be lightweight
  2. It should have a nice Look&Feel
  3. It should be customizable
  4. It should make my work easier
  5. It should support utf8

Lightweight and fast

One of those applications that I open and close the most, is the terminal emulator. That’s why I really appreciate if those windows are fast and if they don’t need much resources. urxvt can be started in daemon-mode in order to save resources. This could be a line of a $HOME/.xsession:

urxvtd -q -f -o

Now we can start urxvt in client-mode:

urxvtc

This client starts with the process-id of the daemon:

urxvtd(4225)─┬─cmus(4305)─┬─{cmus}(4306)
             │ ├─{cmus}(4307)
             │ ├─{cmus}(4308)
             │ ├─{threaded-ml}(4309)
             │ └─{threaded-ml}(4313)
             ├─zsh(4226)
             ├─zsh(4254)───pstree(4336)
             └─zsh(4281)───htop(4301)

There is a wrapper called urxvtcd which starts the daemon first if it isn’t already running. This wrapper is a nice alternative for starting the daemon in the beginning of a xsession.

Be aware: if you kill(xkill) one of the terminals, you will loose all your terminals at once! If you don’t want to open rxvt with a daemon, you can just run it normal using the command: urxvt

Look&Feel

By default urxvt looks quite ugly:

After some modifications it looks fancy:

Customizing urxvt

urxvt can be customized by command-line or just via .Xresources (or $HOME/.Xdefaults). That’s my $HOME/.Xdefaults:

URxvt*termName: rxvt-unicode
URxvt*geometry: 100x30
URxvt*loginShell: true
URxvt*scrollColor: #777777
URxvt*scrollstyle: plain
URxvt*scrollTtyKeypress: true
URxvt*scrollTtyOutput: false
URxvt*scrollWithBuffer: false
URxvt*secondaryScreen: true
URxvt*secondaryScroll: true
URxvt*scrollBar: true
URxvt*scrollBar_right: true
URxvt*scrollBar_floating: true
URxvt*fading: 30
URxvt*utmpInhibit: false
URxvt*urgentOnBell: false
URxvt*visualBell: true
URxvt*mapAlert: true
URxvt*mouseWheelScrollPage: true
URxvt*background: Black
URxvt*foreground: White
URxvt*colorUL: yellow
URxvt*underlineColor: yellow
URxvt*font: -xos4-terminus-medium-*-*-*-20-*-*-*-*-*-iso8859-15,xft:terminus:pixelsize:12
URxvt*boldFont: -xos4-terminus-bold-*-*-*-20-*-*-*-*-*-iso8859-15,xft:terminus:bold:pixelsize:12
URxvt*italicFont: xft:Bitstream Vera Sans Mono:italic:autohint=true:pixelsize=12
URxvt*boldItalicFont: xft:Bitstream Vera Sans Mono:bold:italic:autohint=true:pixelsize=12
URxvt*saveLines: 20000
URxvt*buffered: true
URxvt*hold: false
URxvt*internalBorder:
URxvt*print-pipe: cat > $HOME/$(echo urxvt.dump.$(date +'%Y%M%d%H%m%S'))
URxvt*reverseVideo: false
URxvt*perl-ext-common : default,matcher,selection-to-clipboard
URxvt*url-launcher : firefox
URxvt*matcher.button : 1

Make my work easier

urxvt is very customizable by using perl-extensions. those plugins were shipped with urxvt:

 ls /usr/lib/urxvt/perl 
background keysym-list readline selection-to-clipboard
bell-command kuake remote-clipboard tabbed
block-graphics-to-ascii macosx-clipboard searchable-scrollback urxvt-popup
clipboard-osc macosx-clipboard-native selection xim-onthespot
confirm-paste matcher selection-autotransform
digital-clock option-popup selection-pastebin
example-refresh-hooks overlay-osc selection-popup

A very nice one is matcher:

“match strings in terminal output and change their rendition”

In that way all my web-urls are underlined and if I click they will be opened by firefox.

Another very useful extension is searchable-scrollback:

“searchable-scrollback<hotkey> - incremental scrollback search (enabled by default)”

This extension allows me to search in my scrollback using the shortcut Ctrl+Mod+s

I can defenitely recommend to have a look at the plugins in /usr/lib/urxvt/perl

Last but not least: utf8

urxvt(rxvt-unicode) is the unicode version of rxvt and therefor it does support utf8.

Conclusion

urxvt is an amazing tool. It’s fast, it’s customizable and has all the features I expect of a terminal emulator. If someone want’s to know more about urxvt, I would recommend the article at the arch-linux-wiki.

[ Linux  Sysadmin  RuleOfThree  urxvt  TerminalEmulator  Shell  ]
Except where otherwise noted, content on this site is licensed under a Creative Commons Attribution 3.0 Unported License.

Copyright 2015-present Hoti