Skip to main content

Fonts in Linux

Fonts are important. With different fonts you can emphasize text or just give your text a little pizzazz. Or you could simply make it more readable to your own eyes (which of course is a subjective measure). Many people don't change fonts, but instead change it using italics or bold or change the size (usually measured in points or 72nds of an inch).

There are several different commands to list the fonts available on Linux.

$ fc-list

is one way to list fonts. This will list all the vector based fonts (True Type Fonts or TTF and Adbobe Type 1 Fonts or PBF). There may be other types of Vector fonts installed. Another is:

$ xlsfonts

One thing you may want to do is sort the list or run it through grep to filter out some things, especially since there is no specific order for the fonts to be returned in.

This page might also help: http://crunchbanglinux.org/wiki/urxvt

For many of my consoles (terminal sessions) like xterm, I like to use mono-spaced raster-based fonts. These are some additional fonts I was looking at with xterm:

timb@tardis:~$ xterm -fn r14
timb@tardis:~$ xterm -fn r24
timb@tardis:~$ xterm -fn 12x24
timb@tardis:~$ xterm -fn 10x20
timb@tardis:~$ xterm -fn 5x8
timb@tardis:~$ xterm -fn -rfx-courier-bold-o-normal--0-0-0-0-m-0-microsoft-cp1251

Fonts on Krycek (from xtermfonts didiwiki page)

Some of the fonts I can use:

Various Fonts

xterm -fn '-adobe-courier-medium-r-normal--0-0-0-0-p-0-iso8859-2'
xterm -fn '-bitstream-courier 10 pitch-medium-r-normal--0-0-0-0-m-0-ascii-0'
xterm -fn '-bitstream-courier 10 pitch-medium-r-normal--0-0-0-0-m-0-iso8859-1'
xterm -fn '-misc-fixed-bold-r-normal--0-0-100-100-c-0-iso8859-1'
xterm -fn '-misc-fixed-bold-r-normal--0-0-75-75-c-0-iso8859-1'
xterm -fn '-misc-fixed-medium-r-normal--14-130-75-75-c-70-iso10646-1'
xterm -fn '-misc-fixed-medium-r-normal--15-120-100-100-c-90-iso8859-1'
xterm -fn '-misc-fixed-medium-r-normal--18-120-100-100-c-90-iso8859-1'
xterm -fn '-misc-fixed-medium-r-normal--20-200-75-75-c-100-iso8859-1'

xterm -fn '-misc-fixed-medium-r-semicondensed--12-110-75-75-c-60-iso8859-1'
xterm -fn '-misc-fixed-medium-r-semicondensed--13-120-75-75-c-60-iso8859-1'

xterm -fn '-schumacher-clean-medium-r-normal--0-0-75-75-c-0-iso8859-1'
xterm -fn '-schumacher-clean-medium-r-normal--12-120-75-75-c-60-iso8859-1'

Standard Fixed

xterm -fn '7x13'
xterm -fn '8x13'
xterm -fn '8x16'
xterm -fn '9x15'
xterm -fn 'a14'

Misc Fixed

xterm -fa MiscFixed -fs 8
xterm -fa MiscFixed -fs 10
xterm -fa MiscFixed -fs 12

Fixed

xterm -fa fixed -fs 8
xterm -fa fixed -fs 9

xterm -fa fixed -fs 10

xterm -fa fixed -fs 12

MySQL Security Concern

Soemtimes when I encounter bugs, I have to sit and determine if they are a bug or just an issue. Or maybe, sometimes, it's how I think about something. In this case, maybe it's my process. In any case, I'm writing this up so I don't forget about it, and to share it with the larger community. This "bug" is with both MySQL v3.21 and v4.01 (I found it on 3.21 and verified it against v4.01 in my test environment).

For a little background. Several months ago I built a database for a friend on my web / database server. I added his user account so he could log in directly and created a database for him. I guess the name I chose for the database I built wasn't the best, as I deleted the database and removed his account from my system as the software (I named the database after the software I installed) didn't meet his needs (I used the MySQL commands "DROP USER 'xxx'@'localhost' and DROP USER 'xxx'@'%'". Everything looked good and I didn't see his name under the list of logins anymore (SELECT * FROM users WHERE user_login = 'xxx').

Having completely forgotten about this, I installed a newer version of the software for myself to look at a couple of weeks ago. And then last week, I re-added my friend back onto the server and granted him access to a different database. Imagine my surprise when he Instant Messaged me and asked why "his" database was still there, and what was all my data doing in it. It turned out that just dropping the user didn't remove the account access to the database, and I should also have executed a "REVOKE ALL PRIVILIGES FROM 'xxx'@'localhost' and REVOKE ALL PRIVILIGES FROM 'xxx'@'%'" on his account.

I'm not sure if this is a bug or just a detail in implementation. (And lucky for me I didn't have anything critical in there and that I trust him completely on my systems!)

lowspace.sh

This script is called from a cron job (scheduled task) and emails me on a daily basis this data so I can track disk space usage. I install it on all my systems (though I should probably do something different, like store the values in a database or something).

Of course, this code may or may not work as well for you. And please see my comments at the end.

#! /bin/bash
#
# lowspace.sh
#
# Script is used to identify disk sizes and email the results to the
# people/email list(s).  The list of users could be converted to a text file
# as some point.
#
#Local Varaibles
#
FILE=/tmp/diskspace$date
HOSTSYSTEM=`hostname | tr a-z A-Z`
MAILFROM="$HOSTSYSTEM@kb0odu.us"
MAILTO="tim@example.com"
TODAY=`date +'%b %d, %Y'`
#
#Program substitutions.
#
AWK=/usr/bin/awk
DF=/bin/df
GREP=/usr/bin/grep
HEAD=/usr/bin/head
MAIL=/usr/bin/mail
RM=/bin/rm
SORT=/usr/bin/sort

$DF -h | $HEAD -1 | $AWK '{printf "%-25s %5s %7s MB   %-25s\n", $1, $5, $4, $6}' > $FILE
echo "-------------------------  ----   --------  ----------------------------------" >> $FILE
$DF -m | $GREP '^\/dev' | $AWK '{printf "%-25s %5.0f %10.0f   %-25s \n", $1, $5, $4, $6}' | $SORT -n +1 -r >> $FILE

#28Feb07 TJB - Removed tim from destinations as I don't want to send locally
#mail -s "disk report `date`" -r "$HOSTSYSTEM@kb0odu.us" "tim@example.com" < $file

$MAIL -s "LINUX - Disk Report $HOSTSYSTEM $TODAY" -r $MAILFROM $MAILTO < $FILE
$RM $FILE

Just sample code from my script.

You will also note that I use substitutions in my code. After being hacked once several years ago, I decided to hard-code the specific (and correct) paths in my shell scripts to ensure that an automated job (like this one can be) would not execute the wrong copy of the script. Of course, that doesn't solve the problem of the correct binaries being replaced. (See my AIDE presentation for some help with that.)

Drupal node table information

I don't advocate updating databases without going through the application. However, I had issues with some data when I migrated it from one database to another and had to fix the data.

This is REALLY not recommended, and your results will vary depending on which version you are using.

This SQL generated the update statement I needed to run to fix the problem.

SELECT
   ' UPDATE node SET ' ||
   'created = ' || created::text ||
   ', changed = ' || changed::text ||
   ', status = ' || status::text ||
   ', promote = ' || promote::text ||
   ' where nid = ' || nid::text || ';'
FROM
   node
ORDER BY
   nid
   ;

The following fields are explained here:

  • created - The date/time the node was created in integer format
  • changed - The date/time the node was last updated in integer format
  • status - Whether the node is published (1) or not (0)
  • promote - Wether the node is promoted to the front page (1) or not (0)
  • type - Type of content

A required reading list for Geeks

Excuse the formatting. Copying it over from OpenOffice it threw off my tab marks and things. I've included references for all my sources at the bottom (end).


Many people have written a recommended reading list for “geeks.” I'm not sure I can claim to be all knowing, but at my first brush with this, I figured I'd take some books from various lists and add them with my own (there was already a lot of overlap) to produce my own list. While I've read many of them, I still have quite a way to go.

These are some "random" books I need to track down (I haven't yet found the author...just haven't devoted the time to it).

A Canticle for Leibowitz

Code Complete

Conelius

Curse of the Challion

Discworld

Elric

Fallen Angels (www.webscription.net//c-1-free-library.aspx)

Gene Wolfe

Individuals and their Rights

Intervention

IWoz: Computer Geek to Cult Icon

Rorum

Sophie's World

Tau Zero

The City & The City China

The cluetrain Manifesto

The Mythical Man-Month:Essays on Software Engineering

The Phantom Tollbooth

Time Enough for Love

To Fly With Pegasus

Tunnel In The Sky

V for Vendetta

Watchmen

Where the Wild Things Are

Wicked: the Life and Times of the Wicked Witch of the West


This is a collection of books (where a specific title or series was listed) sorted by the Author.

Author Book(s)
Abbott, Edwin Abbott Flatland
Adams, Douglas Hitchikers Guide to the Galaxy (Series)
Adams, Scott The Dilbert Principle
Aldrin, Buzz Encounter With Tiber
Alexander, Christpoher A Pattern Langauge
Anthony, Piers Apprentice Adept Series
Anthony, Piers Xanth (Series)
Anthony, Piers Incarnations of Immortality (Series)
Aristotle On Politics
Asimov, Isaac I, Robot
Asimov, Issac Bicentennial Man
Assimov, Issac Foundation (Trilogy?)
Aurelius, Marcus Mediatations
Berry, Max Jennifer Government
Beshers, Alex Rim (Series – Rim, Mir, Chi)
Blish, James A Case of Conscious
Bradbury, Ray Fahrenheit 451
Bradbury, Ray The Illustrated Man
Bradbury, Ray Martian Chronicles
Brin, David Uplift (Series)
Brin, David Startide Rising
Brin, David Sundiver
Brooks, Terry The Sword of Shannara
Brooks,Max World War Z:An Oral History of the Zombie War
Brown, Craig & Ikbal, Javed The Laidoff Ninja
Burroughs, Edgar Rice John Carter of Mars (Series)
Burroughs, Edgar Rice Tarzan of the Apes (Series)
Calvino, Italo Cosmicomics
Calvino, Italo If On A Winter's Night A Traveller
Campbell, Bruce If Chins Could Kill: Confessions of a B Movie Actor
Card, Orson Scott Enders Game
Card, Orson Scott Ender (Series)
Carey, Jacqueline Kushiel
Carr, Nicholas G. Does It Matter?
Castaneda, Carolos Unknown
Chaucer Canterbury Tales
Cherryh, C.J. Heavy Time
Cherryh, C.J. Foreigner
Clark, Arthur C 2001 A Space Odyssey
Clarke, Arthur C. Profiles of the Future: An Inquiry into the limits of the Possible
Clarke, Arthur C. Rendezvous With Rama
Colfer, Eoin Artemis Fowl (Series)
Colfer, Eoin And Another Thing
Cook, Rick The Wiz Series
Coupland, Douglas Unknown
Crichton, Michael Airframe
Crichton, Michael Jurassic Park
Crichton, Michael Prey
Crispin, A. C. The Han Solo Trilogy
Crowley, John Little, Big
Dan Ariely Predicably Irrational
De Montaigne, Michel Essays
Delaney, Samuel R Dhalgren
Dick, Philip K Do Androids Dream of Electric Sheep?
Dick, Philip K. Bladerunner
Dickinson, Gordon R Alien Art
Donaldson, Stephen R The Gap
Drake, David Royal Cinnabar Navy (Series)
Drake, David Reaches (Series)
Drake, David Lieutenant Leary
Eco, Umberto Foucault's Pendulum
Eddings, David Belgariad (Series)
Effinger, George Alec When Gravity Falls
Epictetus Discourses
Erikson, Steven Unknown
Feist, Raymond E. The Serpentwar Saga (Series)
Flint, Eric 1632
Forstchen, William R The Lost Regiment
Gabaldon, Diana Voyager (Series)
Gaiman, Neil American Gods
Gates,Bill The Road Ahead
Gently, Dirk Holistic Detecive Agency (Series)
Gerrold/Niven The Flying Sorcers
Gibson, William Difference Engine
Gibson, William Neuromancer
Haldeman, Joe The Forever War
Hamilton, Peter Night's Dawn Trilogy
Hawking, Stephen A brief History of Time
Heinlein, Robert A The Number of the Beast
Heinlein, Robert A The Cat Who Walks Through Walls
Heinlein, Robert A Have Spacesuit WilL Travel
Heinlein, Robert A Farnham's Freehold
Heinlein, Robert A Job: A Comedy of Justice
Heinlein, Robert A Friday
Heinlein, Robert A Past Through The Future
Heinlein, Robert A Stranger in a Strange Land
Heinlein, Robert A Starship Troopers
Herbert, Frank Dune (Series)
Herbert, Frank Destination Void
Herbert, Frank The Dosadi Experiment
Hoban, Russell Riddley Walker
Hodgson, William Hope The Night Land
Hofstadter, Douglas R Godel, Escher, Bach: An Eternal Golden Braid
Homer Odysey
Homer Illiad
Hoyle, Fred A for Andromeda
Huxley, Aldous Brave New World
Iles, Greg Various
Jacques, Brian Redwell (Series)
Johnson, Steven Everything Bad is Good for You
Jones, Tery Larry Cottington
Kidder, Tracy The Soul of a New Machine
King, Stephen Dark Tower Series
King, Stephen The Stand
L'Engle, Madeline Wrinkle in Time (Series)
Laumer, Keith Various
Leguin, Ursula K Wizard of Earthsea
Lem, Stanislaw Various
Levy, Steven Hackers: Heroes of the Computer Revolution
Lewis, C.S. The Chronicles of Narnia (Series)
Locke, John Long, Lazurus(?)
Lopate, Philip The Art of the Personal Essay
Lovecraft, H.P. The Shadow over Innsmouth
Lovecraft, H.P. The Call of Cthulhu
Lovecraft, HP Shadows over Innsmouth
McCaffrey, Anne Pern (Series)
Nash, Nicole Bremer The Geek Atlas
Niven & Pournelle Lucifer's Hammer
Niven & Pournelle Fallen Angels
Niven & Pournelle Footfall
Niven, Larry Ringworld
Niven, Larry Known Space
Niven, Larry & Pournelle The Mote in God's Eye
Norton, Andre Various
Orwell, George 1984
Ovid  
Peter, Laurence J & Hull The Peter Principle: Why Things Go Wrong
Pineiro, R. J. Havoc
Piper, H. Beam Little Fuzzy (Series)
Pirsig, Robert M Zen and the Art of Motorcycle Maintenance
Pirsig,Robert M Lila
Pratchett, Terry Tiffany Aching (Series)
Pratchtt, Terry Good Omens
Pullman, Philip His Dark materials
Rand, Ayn The Fountainhead
Rand, Ayn Atlas Shrugged
Reynolds, Alastair Revelation Space
Rhodes, Richard The Making of the Atomic Bomb
Ringo, John Looking Glass (Series)
Ringo, John Al'Denata (Series)
Robinson, Kim Stanley Various
Rowlings, J K Harry Potter
Russell, Eric Frank Wasp
Saberhagen, Brett Berserkers (Series)
Sagan, Carl Dragons of Eden
Sagan, Carl Contact
Scalzi, John Old Man's War
Scalzi, John Ghost Brigades
Seneca Letters from a Stoic
Shakespere, William Various
Shelley, Mary Frankenstein
Sheppard, Mike Kris Longknife (Series)
Simmons, Dan Hyperion
Sitchin, Zecharia The Twelf Planet
Smith, E. E. Spacehounds of the IPC
Smith, E. E. Lensman (Series)
Spillane, Mickey Various
Steele, Allen Various
Stephenson, Neal Anathem
Stephenson, Neal Snow crash
Stirling, S.M. Emberverse
Stirling, S.M. Nantucket
Stoll, Clif The Cuckoo's Egg
Stross, Chrales Cthulu Mythos (Series)
Suarez, Daniel (High Tech Thrillers)
Tapscott, Don Wikinomics:How Mass Collaboration Changes Everything
Toffler, Alvin The Next Wave
Toffler, Alvin Future Schock
Tolkien, JRR The Lord of the Rings Trilogy
Tolkien, JRR The Hobbit
Turtledove, Harry Guns of the South
Varley, John The Ophiuchi Hotline
Verne, Jules 20000 Leagues Under the Sea
Vidal, Gore Messiah
Vise, David A. The Google Story
Vonnegut, Kurt Player Piano
Vonnegut,Kurt Slaughterhouse-Five
Weber, David Safehold (Series)
Weber, David Honor Harrington (Series)
Wells, H.G. War of the Worlds
Wells, HG The Time Machine
Williams, Tad Otherland (Series)
Wilson, Robert Anton, et al Illuminatus Trilogy
Wyndham, John The Day of the Triffids
Zachary, G. Pascal Show-Stopper!
Zelasny, Roger Amber (Series)
Zelasny, Roger Jack of Shadows (Series)

Some references, for those who are interested, include:

http://blogs.techrepublic.com.com/geekend/?p=413

http://blogs.techrepublic.com.com/geekend/?p=695

http://blogs.techrepublic.com.com/geekend/?p=4574

Additional resources

Geeks and IT pros are not always one in the same: 10 books every IT pro should read (http://blogs.techrepublic.com.com/10things/?p=1209).

Jay Garmon likely doesn’t agree with me either: The perfect sci-fi library (http://blogs.techrepublic.com.com/geekend/?p=1246).

Creating A Drupal Database

The following SQL will create a PostgreSQL database for Drupal. I'm calling it drupal in this case, but you can call it whatever you want.

CREATE DATABASE drupal
 WITH OWNER = drupalweb
      ENCODING = 'UTF8'
      TABLESPACE = pg_default
      LC_COLLATE = 'en_US.UTF-8'
      LC_CTYPE = 'en_US.UTF-8'
      CONNECTION LIMIT = -1;
GRANT CONNECT, TEMPORARY ON DATABASE drupal TO public;
GRANT ALL ON DATABASE drupal TO drupalweb;

Uptime vs Availability

Do we need to sacrifice system uptime against system availability. And I use the term system availability to identify both uptime and unscheduled outages. So here system availability includes time from both unscheduled and scheduled outages. Why would I ask such a thing? Systems crash for all kinds of reasons: failure in the garbage collector to collect objects or collecting the wrong objects. So why do we need to do regular scheduled reboots of the system?

How about to ensure that the system is configured correctly to handle a reboot automatically. Frequent patches, installation of new software and configuration changes can all affect the boot process. And if the system hasn't been booted in the last quarter, the last 90 days, do you know that it will successfully boot and launch the operating system and all services? What about adding and removing (and even changing the configuration) of services and applciations? Will taht cause problmes? For linux, changes in mount-points could cause additional problems... as is changes in the remote systems a server depends on? Does taking a premptive boot monthly or quarterly reduce your risk and guarantee more system availabilty at the expense of uptime? Is it worth it? Better yet, can you take the risk and have a significant outage against your overall system avaialability for the sake of uptime?

http://www.standalone-sysadmin.com/blog/2010/09/linux-machines-with-no-rebooting-is-this-what-we-want/

Finding the UUID for Linux Drives

UPDATE: I use the term "Drives" here for two reasons. One, people coming from Windows understand a harddisk drive (generally C: or another "device" letter). Two, this is specific to harddrives and not other devices in Linux (like the terminal, printer or scanner).

The Universally Unique Identifier (UUID) is a good way to mount drives under Linux with SATA drives (or any drives, PATA or IDE). This ensures that when you have more than one harddrive, it always gets mounted to the same location specified in /etc/fstab. The reason is that SATA drives are mounted when they're found and on one reboot can come up as /dev/sda and the next time as /dev/sdb.

So in order to set up your file system table correctly, you should specify the UUID instead of the physcial device. So your /etc/fstab will look like this:

Ok, so if you want to use the UUID, how can you find it? We're assuming the drive is already mounted, of course!

One way is to use

$ ls -l /dev/disk/by-uuid
lrwxrwxrwx 1 root root 10 11. Okt 18:02 485554c3-e681-4254-9344-6f038c826fb8 -> ../../sda2

This will list all the devices by UUID and tell you where they're currently mounted. Another would be to use the blkid command.

# blkid /dev/sda1
/dev/sda1: LABEL="/" UUID="485554c3-e681-4254-9344-6f038c826fb8" SEC_TYPE="ext2" TYPE="ext3"

One problem with this is that the blkid command can only list one device at a time. A secondary problem is that the command blkid has to be run as the root user.

Additional information can be found by googling Linux and UUID.