7

By default, on Ubuntu, rxvt terminal is black on white. How do I change it to white on black?

I'm running Lubuntu 16.04 LTS

  • 1
    You can launch it with rxvt -fg white -bg black – Terrance Feb 11 '17 at 22:36
10
+50

Note: Updated answer to include desktops like GNOME and LXDE that do not load .Xresources or .Xdefault files by default. Also updated for packages rxvt-unicode and rxvt differences.


You can launch it with the command in a terminal window:

rxvt -fg white -bg black

which sets the foreground to white and the background to black.

Or you can launch it using Alt+F2 and typing it in:

enter image description here

Either way listed above should give you a rxvt terminal that looks like this:

enter image description here

To make it permanent, you can add the following lines to the end of your ~/.Xdefaults or ~/.Xresources file:

Very important:

If you installed rxvt-unicode add these lines to your .Xresources file:

URxvt*background: black
URxvt*foreground: white

If you installed just rxvt add these lines:

Rxvt*background: black
Rxvt*foreground: white

URxvt can support more fonts.

If you wanted to use a Monospace 9 font with urxvt, add a line like this:

URxvt*font: xft:Monospace:size=9:antialias=true

Or you can use fc-list | sort to list all fonts available, then you can find one you want and set it like this:

URxvt*font: xft:DejaVu Sans Mono:size=9:antialias=true
URxvt*boldfont: xft:DejaVu Sans Mono:bold:size=9:antialias=true

Rxvt has limited font support.

If you run the command xlsfonts from a terminal window, it shows you all the fonts that can be loaded by rxvt instead of urxvt. Here is some examples:

xlsfonts | less

The list will look something like this (truncating for space):

-arabic-newspaper-medium-r-normal--0-0-100-100-p-0-iso10646-1
-arabic-newspaper-medium-r-normal--32-246-100-100-p-137-iso10646-1
-bitstream-bitstream charter-bold-i-normal--0-0-0-0-p-0-adobe-standard
-bitstream-bitstream charter-bold-i-normal--0-0-0-0-p-0-ascii-0
-bitstream-bitstream charter-bold-i-normal--0-0-0-0-p-0-iso10646-1
-bitstream-bitstream charter-bold-i-normal--0-0-0-0-p-0-iso8859-1
-bitstream-bitstream charter-bold-r-normal--0-0-0-0-p-0-adobe-standard
-bitstream-bitstream charter-bold-r-normal--0-0-0-0-p-0-ascii-0
-bitstream-bitstream charter-bold-r-normal--0-0-0-0-p-0-iso10646-1

Or you can find a font you want using xfontsel and select all the settings you want and it will create the line you add like this:

enter image description here

You will just have to play around till you find one you like.

Add that line to your .Xresources file.

Rxvt*font: -misc-fixed-medium-r-normal--13-120-75-75-c-70-iso8859-1

Anytime you .Xdefaults or .Xresources file(s), reload them with the following command(s) from a terminal window (requires restart of rxvt terminal if you are using it):

xrdb -load ~/.Xdefaults

or

xrdb -load ~/.Xresources

Note: If you have a desktop like LXDE installed, these files do not load by default, but if you create ~/.xinitrc with using which ever file you want as either .Xresources (recommended) or .Xdefaults and add the following line to the file:

xrdb -load ~/.Xresources &

Then make the .xinitrc executable:

chmod +x ~/.xinitrc

Reboot, then all you have to do is launch rxvt as normal.


Screenshot from LXDE VM

enter image description here

Hope this helps!

  • This doesn't do anything for me. Is there any way to troubleshoot it? – Nickolai Leschov Feb 12 '17 at 9:27
  • Ues, rxvt -fg white -bg black works as intended (and ~/.Xdefaults or ~/.Xresources) does not; and no, these files did not previously exist. – Nickolai Leschov Feb 12 '17 at 22:46
  • It's called x11-xserver-utils on Ubuntu and it's already installed. I have reinstalled, but no luck. – Nickolai Leschov Feb 13 '17 at 0:05
  • @NickolaiLeschov I have seen in another post that you are running LXDE, so I modified my answer to include how to make this work in LXDE, which I have tested myself in a VM and it works fine. – Terrance Feb 16 '17 at 14:34
  • could you, by chance, tell how to change font in rxvt, too? E.g. "Monospace 9" – Nickolai Leschov Feb 16 '17 at 18:31

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.