Administration
  Home arrow Administration arrow Page 2 - Personalizing the User Environment in BSD
Dev Shed Forums  
Administration  
AJAX  
Apache  
BrainDump  
DHTML  
Flash  
Java  
JavaScript  
Multimedia  
MySQL  
Oracle  
Perl  
PHP  
Practices  
Python  
Reviews  
Security  
Smartphone Development  
Style-Sheets  
Web Services  
XML  
Zend  
Zope  
Mobile Linux  
App Generation ROI  
IBM® developerWorks  
Forums Sitemap  
E-Commerce Hosting  
Linux Web Hosting  
Managed Hosting  
Small Business Hosting  
VPS Hosting  
Weekly Newsletter

 
Developer Updates  
Free Website Content 
 RSS  Articles
 RSS  Forums
 RSS  All Feeds
Write For Us Get Paid  
Request Media Kit
Contact Us  
Site Map  
Privacy Policy  
Support  
 USERNAME
 
 PASSWORD
 
 
  >>> SIGN UP!  
  Lost Password? 
Google.com  
ADMINISTRATION

Personalizing the User Environment in BSD
By: O'Reilly Media
  • Search For More Articles!
  • Disclaimer
  • Author Terms
  • Rating: starstarstarstarstar / 5
    2006-12-14


    Table of Contents:
  • Personalizing the User Environment in BSD
  • Hack 6: Get Your Daily Dose of Trivia
  • Hack 7: Lock the Screen
  • Hack 8: Create a Trash Directory

  • Rate this Article: Poor Best 
      ADD THIS ARTICLE TO:
      error-file:tidyout.log Del.ici.ous error-file:tidyout.log Digg
      error-file:tidyout.log Blink error-file:tidyout.log Simpy
      error-file:tidyout.log Google error-file:tidyout.log Spurl
      error-file:tidyout.log Y! MyWeb error-file:tidyout.log Furl
    Email Me Similar Content When Posted
    Add Developer Shed Article Feed To Your Site
    Email Article To Friend
    Print Version Of Article
    PDF Version Of Article

     
     
    ADVERTISEMENT


    Personalizing the User Environment in BSD - Hack 6: Get Your Daily Dose of Trivia
    ( Page 2 of 4 )

    Test your change by copying some text with the left mouse button and past ing 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 of man 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/usm0 instead of /dev/psm0 .

    A serial mouse physically plugged into COM1 would be /dev/cuaa0 . You may have to experiment with the type, as auto doesn’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 . Choose Configure , then Distributions , and select games with your spacebar. Press Tab to select OK , then exit out of sysinstall 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, fortune comes with switches, some of which are more amusing than others. I’ll leave it to you to peruse man fortune .

    Pursuing Trivia

    I’m a trivia buff, so I love using the calendar command. Contrary to logic, typing calendar won’t show me this month’s calendar (that’s the job of cal ). 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 by calendar . 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 the which command 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 use date , 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 read man 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 Administration Articles          >>> More By O'Reilly Media
     

       

    ADMINISTRATION ARTICLES

    - Network Booting via PXE: the Basics
    - Scalix: Linux Administrator`s Guide
    - Network Administration with FreeBSD 7
    - Components of an Information Architecture
    - The Anatomy of an Information Architecture
    - Configuring Load-Balanced Clusters
    - Load-Balanced Clusters
    - UNIX Time Format Demystified
    - Making Changes in the CVS
    - Building Your First CVS Repository
    - CVS Quickstart Guide
    - Authorizing Users in Samba
    - Handling User Accounts in Samba
    - Authentication in Samba
    - Accounts, Authentication, and Authorization





    © 2003-2009 by Developer Shed. All rights reserved. DS Cluster 3 Hosted by Hostway
    For more Enterprise Application Development news, visit eWeek