Skip to content

Instantly share code, notes, and snippets.

@stark
Last active August 29, 2015 14:21
Show Gist options
  • Save stark/3e021c6e2543d309bbe9 to your computer and use it in GitHub Desktop.
Save stark/3e021c6e2543d309bbe9 to your computer and use it in GitHub Desktop.
LinuxBBQ Academy

Lesson 5 - Terminal I: Configuration

Just recently a fellow griller asked a very good question:

"How can I change the colors of my terminal?"

Read the answers here: http://ow.ly/NkUt4

We should mention, though, that this only works for the terminals xterm and rxvt and it's modifications. More about this later. We recommend to stay with the default terminal emulator (xterm in the Academy release), at least for a few days. It has it strengths, especially in size, speed, dependency count and customization.

Now you ask yourself: How can I change the font, not just the colors?

First of all, you need a bit of choice in fonts.

Let's ask out package manager what is there in the repositories:

search xfonts | more

We add the '| more' because the output will be longer than one screen height, and '| more' (pipe to more) will pause the scrolling.

So, should we add a new font? You probably will like Terminus:

ins xfonts-terminus

Let APT do its work. When finished, we can actually change the fonts in our terminal.

You will need to edit a file named ~/.Xresources:

nano ~/.Xresources

You see the mention of fonts there. With a strange, long name behind it. Don't just edit it randomly, you need a correct name there, which you find out with xfontsel. But first, make it easy for yourself.

Move the cursor onto the line starting with '*font:' and press Ctrl + k and then twice Ctrl + u. You have just successfully copied and inserted a line!

One of these two identical lines you prepend with a '!' (exclamation mark). This is our backup line. Move the cursor to the line without the exclamation mark, and remove the long string that is there behind '*font:', this long string, FYI, is called X Logical Font Description.

Nevermind, I had to look it up too.

Let's get the name of the other font, so that we can paste it in there. Press Alt + p and enter xfontsel, then hit Enter.

In the field 'fmly', press the mouse button, keep it pressed, and select terminus. Move over to 'wght' and select 'medium', pick 'slant' and then 'r', then go over to 'pxlsz' and choose, for example, 12. This is usually enough.

All changes are visible on the fly, so you can see how your selected font looks like:

xfontsel

And when you found a pleasant looking set of fonts, click on 'Select', then move over to GNU nano and press either the middle mouse button or Alt + Insert. Be careful where your cursor is in GNU nano, the selection will be paste exactly there.

Remember, we paste it behind '*font:', so that it looks like this:

*font:        -*-terminus-medium-r-*-*-12-*-*-*-*-*-*-*

You can do the same for your bold font, too.

Little hint: Everything stays the same, except 'wght' which should read 'bold'. Have a try ;) {: .callout .info}

If you now save and exit GNU nano, remember to run a command that reads the ~/.Xresources file again:

xrdb -merge ~/.Xresources

After this, open a new terminal (don't close the old one yet), and see the changes you made. If there is no new terminal opening, you seriously fucked the ~./Xresources file up. Nevermind!

cp /etc/skel/.Xresources ~/.Xresources

Will save some serious ass. Again, remember to re-read the ~/.Xresources file:

xrdb -merge ~/.Xresources

This should be enough for a start.

Pro tip: if you edit the ~/.wmii/wmiirc_local file, you will see that the fonts can be changed there, too. {: .callout .info}

Further readings:

Xresources/Xdefaults colors thread - LinuxBBQ Forum

http://ow.ly/NkP2n

Xterm configuration - Unix4lyfe

http://ow.ly/NkP45

Some notes about the xterm menu - Scarygliders

http://ow.ly/NkP7d

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment