FreeBSD: Setting a user’s locale and charset via a login class.

One way to set a user’s locale and charset is to:

  1. create a new login class,
  2. set the login class’s locale and
  3. set the user’s login class as the newly created class.

Example: Setting petur‘s locale and charset to en_GB.UTF-8 and UTF-8, respectivly.

Append the following to /etc/login.conf

danishKeyboard|Users with a Danish Keyboard:\

Update the capability database by executing cap_mkdb /etc/login.conf.

Set danishKeyboard as petur‘s login class by executing pw user mod petur -L danishKeyboard.

Finally, log in as petur and confirm that the locale has been correctly set as well as that the console correctly displays UTF8 characters.

Mapping Caps Lock to ESC in XFCE

I prefer the Caps Lock key over ESC because the travel to that key is shorter.

To map Caps Lock to ESC add the following to a script and ensure it executes shortly after logging into X.

/usr/local/bin/xmodmap -e "clear Lock"
/usr/local/bin/xmodmap -e "keysym Caps_Lock = Escape"

In my case, I use XFCE so I auto start it by adding /home/<user>/bin/ under Settings -> Session and Startup -> Application Autostart -> Add -> Command.

How to flush DNS cache Linux, Mac OS X, Windows

[ad#Google Adsense-1]
To flush DNS cache on Microsoft Windows (Win Vista, Win 7)

Run hte command prompt with Administrator privileges

Type ipconfig /flushdns

To flush the DNS cache on Linux, restart the nscd daemon:-

Linux does not cache dns by default. Some systems might have a dns cahcing service such as nscd. Restarting the DNS caching service will flush the DNS cache.

To restart the nscd daemon, type /etc/rc.d/init.d/nscd restart in your terminal, on Ubuntu or Debian you need to use sudo service nscd instead

To flush the DNS cache in Mac OS X 10.6 Snow Leopard

type dscacheutil -flushcache in the Terminal


[ad#Google Adsense-1]