红联Linux门户
Linux帮助

configuration xterm on linux

发布时间:2008-03-16 01:46:44来源:红联作者:rincess
xterm is a terminal which runs in X. In linux when you open xterm, you get a small window with a small - hard to read - font by default. Compared to the ordinary xterm, the gnome-terminal and konsole come loaded with lots of features and are good to view. So why would anybody use an xterm over the other two? The answer lies in its low memory foot print. While konsole takes a whooping 8MB and gnome-terminal over 3MB of memory, you can run xterm under 1MB which makes it blazingly fast even when your computer has only 64MB of RAM. Below I describe ways in which you could configure xterm to make it look good and easier to read with larger fonts.

If you look in the man page of xterm, you will find that you can configure xterm's colour, font, font size ,the position in which to load the window w.r.t your screen and much more. The first thing you to do is decide on your choice of font and its size for your xterm. This can be achieved by running xfontsel as follows:

$ xfontsel

This will open an X window where you can decide on the font type and size. Once you have decided, note down the values as shown in the xfontsel dialog box. It will look something like this ...

-*-fixed-medium-r-*-*-18-*-*-*-*-*-iso8859-*

...if you have selected a fixed, medium 18pt regular font with iso8859 support.These values will be used while starting xterm. Also to specify the size and position of the xterm window, you can use the -geometry option. Now to test your settings, execute xterm. I have executed xterm with the following settings:

$ xterm -font -*-fixed-medium-r-*-*-18-*-*-*-*-*-iso8859-*

-geometry 70x24

You will find that it opens with better font clarity. But it is very tedious to run the above command each time you want to open xterm. So you create an alias for it and enter the following line into your .bashrc or .bash_profile file. I have entered it in the .bashrc file in my home directory.

#File: ~.bashrc

alias xterm='xterm

-font -*-fixed-medium-r-*-*-18-*-*-*-*-*-iso8859-*

-geometry 70x24'

The next time you type xterm, your system will execute the program with the options in your .bashrc file in your home directory.

There is another more powerful way to achieve the same. That is to pass the parameters to your X server so that it will know how to display your xterm when you execute it. This is as follows:

Create a '.Xresources' file in your home directory and enter the values that you want to set. My .Xresources file is as follows:


# File : .Xresources

xterm*font: -*-fixed-medium-r-*-*-18-*-*-*-*-*-iso8859-*

xterm*font1: -*-*-*-*-*-*-2-*-*-*-*-*-*-*

xterm*font2: -misc-fixed-*-r-normal-*-8-*-*-*-*-*-iso8859-*

xterm*font3: -b&h-lucidatypewriter-bold-*-*-*-12-*-*-*-*-*-*-*

xterm*font4: -*-screen-bold-r-normal-*-16-*-*-*-*-*-iso8859-*

xterm*font5: -*-lucidatypewriter-medium-*-*-*-18-*-*-*-*-*-*-*

xterm*font6: -*-lucidatypewriter-medium-*-*-*-20-*-*-*-*-*-*-*

xterm*font7: -dec-terminal-bold-r-normal-*-14-*-*-*-*-*-iso8859-*

XTerm*background: white

XTerm*foreground: black

XTerm*pointerColor: red

XTerm*pointerColorBackground: black

XTerm*cursorColor: navy

XTerm*internalBorder: 3

XTerm*loginShell: true

XTerm*scrollBar: false

XTerm*scrollKey: true

XTerm*saveLines: 1000

XTerm*multiClickTime: 250

Figure: XTerm after applying the configuration

As you can see in my .Xresources file above, I have set my xterm to start with a fixed font, white background and black foreground and with no scrollbar.

I have also set other settings like the number of lines to save in history and so on.

Note: You could do the following instead of the above method to get the same effects. Create a file say .x_settings - the file can have any name - and copy the contents of .Xresources to it. Now each time you start an X session, type the following command in the console :

$ xrdb -merge .x_settings

Another method to increase the font size of the xterm is by pressing [Ctrl] key and the right mouse button at the same time while you have focus in xterm window. Then a pop-up menu will come up which can be used to set the font size to your taste. By pressing [Ctrl] key and the middle mouse button, you get a pop-up menu which helps you set/unset a lot of other features of your xterm window like enabling/disabling the scroll bars and so on.

Here I have explained some of the methods by which you can configure xterm to look good. Ofcourse, GNU/Linux is all about the freedom of choice. So xterm is not the only light weight x terminal around. Two other x terminals which are light weight and having even more features like support for transparency that come to mind are eterm and aterm. But the advantage of xterm is that you can be sure of having it in all linux distributions by default where as if you want to use aterm or eterm, you may have to download them from their site and install it in your machine.
文章评论

共有 0 条评论