10 Replies Latest reply: Mar 22, 2006 9:18 AM by tong
tong Level 1 (10 points)

I use X11 most of the times in my research. I found the fact that the xterm in X11 (OS X tiger) by default only stores 64 lines that is "scrolled" out and above of the terminal window. This is rather inconvenient since for some large directories, a simple command like "ls" will push much of the contents out of the xterm buffer and you will not able to view them unless you redirect them into a file.

I know that one can open a new xterm window by using:

xterm -sl 1000 &

so you get 1000 line buffer in stead of the default 64.

However, I would also like the initial window to have a 1000 line buffer as well. This saves time and effort to open a new xterm and close the initial one.

Does any one know how (or if) one can do this, for example by setting certain enviroment variables in the .bashrc file (I use bash most of the times)?

Thank you very much,


Powerbook G4 12", Mac OS X (10.4), Dell PC Windows XP
  • Gary Kerbaugh Level 6 (18,040 points)
    Hi Lianheng,
       That's easy. Just add you "-sl 1000" to the command in your ~/.xinitrc file that starts up the initial xterm.
       If at first you do succeed, try to hide your astonishment.
  • tong Level 1 (10 points)
    Hi Gary,

    Thank you for your suggestion. Could you help me more about the .xinitrc file?

    I don't have a .xinitrc in my home directory. So I created one but not very sure what to write inside it. I first tried

    xterm -sl 1000 &

    X11 failed to start after that, so i changed the line to just

    -sl 1000

    And again X11 crashes at start.

    May be there is the root one in /etc directory that I can copy to home. But somehow I think this may not be the way to go. So could you give me some more advises?


  • Craigwd_2000 Level 4 (1,300 points)
    Try issuing a man .xinitrc at the Xterm prompt. It should pull up a man page explaining what the file does & how to use it.
  • Daniel Macks Level 4 (2,285 points)
    Add a line

    XTerm*saveLines: 1000

    to your ~/.Xresources, restart X11, and all future xterm will have a 1000-line scrollback buffer.
  • Gary Kerbaugh Level 6 (18,040 points)
    Hi Lianheng,
       I'm sorry that I didn't reply right away because I was at work. It's probably a good thing though because I like Daniel's idea better. Of course you'll have to create that file as well.

       Actually you shouldn't create the ~/.xinitrc; you should copy the template with the command:

    cp /etc/X11/xinit/xinitrc ~/.xinitrc

    Then you can edit it as you like. When you don't have such a file, X11 uses the template but after you execute the above command it will use the new one. There is no template for the ~/.Xresources file so if you don't already have one, you can do what Daniel suggests with the command:

    echo 'XTerm*saveLines: 1000' >> ~/.Xresources

       Organic chemistry is the chemistry of carbon compounds.
       Biochemistry is the study of carbon compounds that crawl.
          -- Mike Adams
  • tong Level 1 (10 points)
    Thank you for you all for giving me so much help!

    I tried both methods. The method using .xinitrc worked!

    However, for some strange reason, X11 seemed not to respond to ~/.Xresources. (Of course, once again, I just put in one line in this file). The buffer size is still 64. But I can see why changing the buffer size using .Xresources is a better method. Anyway, I think I have got access to the .Xresources file in my departmental server, I will have a look at that and see what may have been the cause of the problem.

    Thank you very much!

  • Daniel Macks Level 4 (2,285 points)
    If you have a custom .xinitrc, it's possible it doesn't contain the commands to load .Xresources that are present in the default .xinitrc (the one that is used if you have no .xintirc present).
  • tong Level 1 (10 points)
    I actually deleted the .xinitrc when I tried the .Xresources method. And I have just read the default xinitrc file, and it does contain commands to load the .Xresources.

    However, this is what I have also discovered, in the defaut XTerm file, which has path:


    (that X11 dir is the only one I can find in /etc )

    in XTerm, there is no line containing


    is this relevant?
  • tong Level 1 (10 points)
    I have solved the problem!

    The problem is exactly the strange directory name for my X11 in /etc. All links in the /usr/local/X11R6/ are pointed to /etc/X11, but in fact no such directory exsist on my machine, and hence not even the default xinitrc read.

    So, my temporary fix is to copy the .xinitrc template to ~/, and it worked.

    I am thinking may be I can put a symbolic link

    ln -s X11 X11.AppleBackup

    in /etc ?

    Any suggestions for a better method? Of course I can also change the dir name, just afraid some programs may depend on that name.
  • tong Level 1 (10 points)
    Sorry, just to correct my previous comment:

    The command to use to create symbolic link in /etc should be:

    ln -s X11.AppBackup/ X11

    After I did this, It actually solved many of the other problems associated to my xterm. It is some how strange, why my /etc/X11 is named differently.