xterm – select font name and size from command line and set it as default

I have been very busy last week and specially yesterday with 20 hours of continueous work, but managed to get this working :).

When you right click on Xterm with Ctrl pressed, there pops up a menu for selecting the size of the font. I have always wondered how to set this as default font and/or use this from the command line. So I searched my old homedir and looked for few of the docs that I had to get the information. Here is what I found.

First we need to find the fonts that are installed to use them, so here is the command to do that:

Hack1004$xlsfonts |more


Now you can select the font that you want to use and then we are ready to go.

For selecting the font from the command line invocation of the xterm, the fontname can be specified with -fn and font size with -fs.


xterm -fn -adobe-courier-bold-o-normal–14-100-100-100-m-90-iso8859-1

xterm -fn 8×16

Now for the same to be set as default. The defaults for the xterm can be set in the terminal settings that are read by the xrdb program. These can go in the ~/.Xdefaults . You can see the current one in use by issuing the command:


and then set them using the following entries in .Xdefaults

xterm*saveLines: 10000
xterm*scrollBar: true
xterm*rightScrollBar: true
xterm*jumpScroll: true
xterm*cursorColor: red
xterm*colorBD: darkblue
xterm*colorBDMode: true
xterm*highlightColor: yellow
xterm*activeIcon: false
xterm*awaitInput: true
xterm*scrollTtyOutput: false
xterm*scrollKey: true

xterm*Background: DarkSlateBlue
xterm*Foreground: black

and run

xrdb -merge ~/.Xdefaults

BTW, you can also change the font size using the shift plus/minus.

Find out why a program can\’t seem to access to a file

$ strace php tias.php -e open,access 2>&1 | grep foo.txt Sometimes a program refuses to read a file and you\’re not sure why. You may have display_errors turned off for PHP or something. In this example, fopen(\’/var/www/test/foo.txt\’) was called but doesn\’t have read access to foo.txt.

Strace can tell you what went wrong. E.g., if php doesn\’t have read access to the file, strace will say \”EACCESS (Permission denied)\”. Or, if the file path you gave doesn\’t exist, strace will say \”ENOENT (No such file or directory)\”, etc.

This works for any program you can run from the command-line, e.g., strace python myapp.py -e open,access…

Note: the above command uses php-cli, not mod_php, which is a different SAPI with diff configs, etc.


by David Winterbottom (codeinthehole.com)



URL: http://feedproxy.google.com/~r/Command-line-fu/~3/Zlwqw2g-10c/find-out-why-a-program-cant-seem-to-access-to-a-file