Home arrow Site Administration arrow Page 2 - Personalizing the User Environment in BSD

Hack 6: Get Your Daily Dose of Trivia - Administration

In this second part of a three-part article, you'll learn a few more ways to personalize the user environment in BSD, such as adding some fun trivia, setting up a trash directory, and locking down your screen. It is excerpted from chapter one of the book BSD Hacks, written by Dru Lavigne (Copyright © 2005 O'Reilly Media, Inc. All rights reserved. Used with permission from the publisher. Available from booksellers or direct from O'Reilly Media; ISBN: 0596006799).

TABLE OF CONTENTS:
  1. Personalizing the User Environment in BSD
  2. Hack 6: Get Your Daily Dose of Trivia
  3. Hack 7: Lock the Screen
  4. Hack 8: Create a Trash Directory
By: O'Reilly Media
Rating: starstarstarstarstar / 5
December 14, 2006

print this article
SEARCH DEV SHED

TOOLS YOU CAN USE

advertisement

Test your change by copying some text with the left mouse button and pasting with the right mouse button.

If X Is Not Installed

You can achieve the same results on a system without X installed. Youíll have to add the lines to /etc/rc.conf manually, though.

The example Iíve given you is for a PS/2 mouse. If youíre using another type of mouse, read the ďConfiguring Mouse DaemonĒ section ofman moused. It gives explicit details on figuring out what type of mouse you have and what type of protocol it understands. It even includes a section on configuring a laptop system for multiple mice: one for when on the road and one for when the laptop is attached to the docking station.

For example, if youíre using a USB mouse, the only difference is that the port is/dev/usm0instead of /dev/psm0.

A serial mouse physically plugged intoCOM1would be/dev/cuaa0. You may have to experiment with the type, asautodoesnít work with all serial mice. Again, the manpage is your best reference.

See Also

  • man moused
  • Documentation on enabling mouse support in NetBSD at http://www.netbsd.org/Documentation/ wscons/
  • Documentation on enabling mouse support in OpenBSD at http://www.openbsd.org/faq/faq7.html)

Brighten your day with some terminal eye candy.

 

As the saying goes, all work and no play makes Jack a dull boy. But whatís a poor Jack or Jill to do if your days include spending inordinate amounts of time in front of a computer screen? Well, you could head over to http://www.thinkgeek.net/  to stock up on cube goodies and caffeine. Or, you could take advantage of some of the entertainments built into your operating system.

A Fortune a Day

Letís start by configuring some terminal eye candy. Does your system quote you a cheery, witty, or downright strange bit of wisdom every time you log into your terminal? If so, youíre receiving a fortune:

  login: dru
  Password:
  Last login: Thu Nov 27 10:10:16 on ttyv7
  "You can't have everything. Where would you put it?"
                        -- Steven Wright

If youíre not receiving a fortune, as the superuser type/stand/sysinstall. ChooseConfigure, thenDistributions, and selectgameswith your spacebar. Press Tab to selectOK, then exit out ofsysinstall when it is finished.

Then, look for the line that runs /usr/games/fortune in your ~/.cshrc file:

  % grep fortune ~/.cshrc
  /usr/games/fortune

If for some reason it isnít there, add it:

  % echo '/usr/games/fortune' >> ~/.cshrc

Donít forget to use both greater-than signs; you donít want to erase the contents of your .cshrc file! To test your change, use the source shell command, which re-executes the contents of the file. This can come in handy if youíve updated an alias and want to take advantage of it immediately:

  % source ~/.cshrc
  Indifference will be the downfall of mankind, but who cares?

If youíd also like to receive a fortune when you log out of your terminal, add this line to the end of your .logout file. If you donít have one, and there isnít one by default, you can create it and add this line in one step:

  % echo '/usr/games/fortune' > ~/.logout

Note that this time I used only one greater-than sign, as I was creating the file from scratch. If the file already exists, use two greater-than signs to append your new line to the end of the existing file.

Believe it or not,fortunecomes with switches, some of which are more amusing than others. Iíll leave it to you to peruseman fortune.

Pursuing Trivia

Iím a trivia buff, so I love using thecalendarcommand. Contrary to logic, typingcalendarwonít show me this monthís calendar (thatís the job ofcal). However, I will get an instant dose of trivia, related to the current date:

  % calendar
 
Nov 27     Alfred Nobel establishes Nobel Prize, 1895
  Nov 27     Friction match invented, England, 1826
  Nov 27     Hoosac Railroad Tunnel completed, 1873, in NW Massachusetts
  Nov 28     Independence Day in Albania and Mauritania
  Nov 28     Independence from Spain in Panama
  Nov 28     Proclamation of the Republic in Chad
  Nov 27     Jimi Hendrix (Johnny Allen Hendrix) is born in Seattle, 1942

Cool. I had forgotten it was the anniversary of the Hoosac tunnel, an event that put my hometown on the map.

Itís an easy matter to automate the output provided bycalendar. If you want to see your trivia when you log in or log out, simply add a line to your .cshrc or .logout file. Because the line you add is really just a path to the program, use the output of thewhichcommand to add that line for you:

  % echo `which calendar` >> .cshrc

Again, donít forget to append with >>, or have noclobber set in your .cshrc file [Hack #2].

Sundry Amusements

Of course, there are several other date and time related mini-hacks at your disposal. Here are two you might enjoy.

The current time.Ever wonder what time it is while youíre working on the terminal? Sure, you could usedate, but the output is so small and boring. Try this the next time you want to know what time it is:

  % grdc

Whoa, you can see that one from across the room. Thatís not a bad idea if you want to send your cubicle buddy a hint.

Iíve been known to add /usr/games/grdc to my ~/.logout. When I log out, my terminal displays the time until I press Ctrl-c and log in again. Thatís sort of a built-in password protected screen saver for the terminal.

The phase of the moon.Have you ever readman pom? It has one of the more useful descriptions Iíve seen:

The pom utility displays the current phase of the moon. Useful for selecting software completion target dates and predicting managerial behavior.

Sounds like Dilbert had a hand in that one. If I add the line /usr/games/pom to my ~/.cshrc, Iíll learn a bit about astronomy when I log in:

  % pom
  The Moon is Waxing Gibbous (53% of Full)

Thereís a one-liner to promote water cooler conversation.

Adding Some Color to Your Terminal

Have you ever tried this command?

  % vidcontrol show 
  
0            8 grey
  1 blue       9 lightblue
  2 green     10 lightgreen
  3 cyan      11 lightcyan
  4 red       12 lightred
  5 magenta   13 lightmagenta
  6 brown     14 yellow
  7 white     15 lightwhite

Gee, that reminds me of my old DOS days when I discovered ansi.sys. Yes, your terminal is capable of color and youíre looking at your possible color schemes! (It likely looks much more exciting on your terminal, since itís not in color in this book.)

If you see some colors that appeal to you, add them to your terminal. For example, this command will set the foreground color to yellow and the background color as blue:

  % vidcontrol yellow blue

Note that you can use only colors 1 through 7 as background colors; youíll receive a syntax error if you try to use colors 8Ė15 in your background. Try out the various combinations until you find one that appeals to your sense of taste. You can even add a border if you like:

  % vidcontrol -b red

These settings affect only your own terminal. If you want, add the desired vidcontrol lines to your ~/.cshrc file so your settings are available when you log into your terminal.

If you have problems finding your cursor, try:

  % vidcontrol -c blink

or:

  % vidcontrol -c destructive

Changing the cursor affects all virtual terminals on the system. If other users complain about your improvement, this will bring things back to normal:

  % vidcontrol -c normal

See Also

  • man fortune
  • man calendar
  • man vidcontrol 
  • The games packages, in NetBSD and OpenBSD



 
 
>>> More Site Administration Articles          >>> More By O'Reilly Media
 

blog comments powered by Disqus
escort Bursa Bursa escort Antalya eskort
   

SITE ADMINISTRATION ARTICLES

- Coding: Not Just for Developers
- To Support or Not Support IE?
- Administration: Networking OSX and Win 7
- DotNetNuke Gets Social
- Integrating MailChimp with Joomla: Creating ...
- Integrating MailChimp with Joomla: List Mana...
- Integrating MailChimp with Joomla: Building ...
- Integrating MailChimp with Joomla
- More Top WordPress Plugins for Social Media
- Optimizing Security: SSH Public Key Authenti...
- Patches and Rejects in Software Configuratio...
- Configuring a CVS Server
- Managing Code and Teams for Cross-Platform S...
- Software Configuration Management
- Back Up a Joomla Site with Akeeba Backup

Developer Shed Affiliates

 


Dev Shed Tutorial Topics: