Office of Information Technology
Home

Calendar

Map
Home
Computing

Library

Search

Customizing Your Environment

This section provides a description of the default environment created for accounts on OIT' Unix systems. Many of the default settings can be changed, allowing you to adjust your environment to one that suits your particular needs. When you are comfortable with the basics of Unix, feel free to avail yourself of its considerable flexibility to tailor-make it to your liking.

Start-Up Files

A file named .cshrc resides in the home directory of every Unix user. It contains commands that identify the user's terminal type, set up some common aliases (symbols), and define variables that are essential for a user to be able to perform various functions. Together these settings constitute the user's environment. Every user receives another startup file as well, .login, which is also available for customization. Most settings can appear in either file, because both files are executed each time you log into the system. OIT recommends that the last line in your .cshrc file appear as

    source /usr/site/etc/system.cshrc

This command executes the system-level .cshrc file in addition to your own. Since the system file exists as a way of automatically customizing your environment as changes occur, the command is important, and should be left intact. Some ways of customizing .cshrc are described below.

Shell Variables

When you log in to Unix, the program that you interact with (the command line interpreter) is called the shell. The origin of this name stems from the concept that the program provides a protective layer, or shell, around the operating system which keeps the user from having to interface directly with it. Shells are programmable, and the shell that is used by default at UMBC is the C shell, which derives its name from its C-like programming constructs.

Each time you log in, the system uses your .cshrc file to define variables that will be used by some of the programs you might run during the course of your login session. The most common of these variables are HOME, PATH, USER, MAIL, TERM, and SHELL.

When you enter your username and password to begin your login session, these are validated against your entry in the system's password file. This file contains an entry for each account, consisting of a username, an encrypted password, a user identification number, a group identification number, the user's real-life name, the user's home directory, and the name of the user's default login shell. Provided your username and password are validated, it is from your password file entry that the variable USER is set to your username, HOME is set to your home directory, and SHELL is set to your default shell (usually /bin/csh). Using the tset command, the system queries your terminal, determines its type, sets the appropriate attributes and defines the TERM variable.

Most of the commands and utilities that are distributed with the Unix operating system are stored in either /usr/bsd, /bin or /usr/bin. The programs available on University Computing's systems that are in the public domain, that are purchased from a third-party vendor or that are written locally are placed in one of the following: If the programs are part of the X-Window system, they will be found in either /usr/bin/X11 or /usr/local/bin/ x11. All other binaries that are not part of the operating system are placed in /usr/local/bin. The OIT staff provides support for these binaries to the best of its ability.

Because many of the utilities that you will need fall into one of these categories, it is important that all of these paths be included in your PATH variable, and OIT provides for this with each account. It is not wise to eliminate any paths or otherwise alter this setting unless you are a Unix expert and are doing highly specialized work, and even then it should not be necessary. If you issue the command printenv the values of all defined environment variables will be displayed. The contents of the PATH variable will look something like:

    PATH=:$HOME/bin:/usr/sbin:/usr/local/bin:/usr/bsd: /bin:/usr/bin:/usr/sbin:/usr/demos/bin: /usr/local/X11:/usr/bin/X11:/etc:/usr/etc

To define a shell variable, use the command setenv. For example:

setenv EDITOR /usr/local/bin/emacs Defines your default editor to be emacs.

Shell variables can be undefined with the unsetenv command.

Aliases

A helpful feature for new Unix users is the alias function. This allows a command, possibly with many options, to be assigned to another name, perhaps a shorter name or one that is easier to remember. For example, the word envdoc might be defined as an alias for the complex command that is required to format a document using the troff formatter:

    alias envdoc "tbl envdoc.mm | troff -Tps -mm | psdit | lpr -Pacsps"

Clearly, it would be preferable to type envdoc to invoke this action than to enter the entire command. Aliases should be placed in your .cshrc file so that they will be defined each time you log in (and each time you open a new window if you are using a workstation). If the alias translation includes any blank spaces, enclose it in quotation marks as above. If you are migrating to Unix from VMS and find the names of Unix commands difficult to remember, you may wish to alias some of the Unix commands to the names of VMS commands. For example:

    alias dir ls

    alias delete rm

    alias copy cp

    alias search grep

The alias command without arguments will give you a list of all aliases defined for your session, and the command unalias followed by an alias name will undefine an alias. Note that this alias function is similar to, but separate from, the function that allows you to set up electronic mail address aliases. .

Other Shell Features

The C shell is a very powerful tool. The manual page for the C shell, invoked by man csh, gives a full list of all of the adjustable shell features and all of the shell's capabilities. Following is a brief list of some of the more commonly used shell features. The options are toggles---that is, they are either on or off. The set command followed by an option name will set that option. To turn off the option, either the unset command can be used, or the reverse option can be set.

    set clobber

    Unix does not maintain file versions as does VMS. If a file name exists, as in proj1, and you create another file of that name, the default option, clobber, will overwrite the existing file.

    set noclobber

    Turns off the clobber feature.

    set glob

    Enables the use of wildcard characters for file name matching under Unix. Click here for information about wildcards.

    set noglob

    Disables the use of wildcards for file name completion.

    set history

    The history mechanism provides limited command recall capabilities. The command set history=20 will cause your last 20 commands to be saved into a file called .history in your home directory. There are several ways to invoke the command recall. Two exclamation points (!!) will cause the last command issued to be repeated. An exclamation point followed by a number will cause the command represented by that number in the .history file to be repeated. Finally, an exclamation point followed by the first few letters of the desired command (which must be present in the.history file) will cause the command to be repeated.

    set ignoreeof

    This prevents the use of CTRL/d for logging out. If this option is set and you attempt to use CTRL/d, the system will issue the message "Use logout."

    set noignoreeof

    Enables use of CTRL/d for logging out.

Setting Up the Keyboard

Certain vital functions have been mapped to various special keys or special key sequences. Some of these are called control sequences because the <CTRL> key must be depressed simultaneously with some character key. Control sequences are shown liberally throughout this document, and a list of command line editing control sequences can be found at the end of the section on Commands.

Although it is possible to change these key mappings, this is not recommended. One key stroke that you may need to redefine, however, is the function which erases one character. That function is mapped to the <DELETE> key, but depending on your keyboard, it may be more convenient to move this function to the key labelled <BACKSPACE> on some keyboards. To make this change, use the command:

    stty erase press-the-backspace-key

If you would like to see what other input and output control options are set on your login session, use the command stty -a. Refer to the man page on stty for an explanation of all of the available options. If any program you run should ever leave your screen in a strange state---for example, if the commands you enter should cease to be echoed to your screen, try the command tset. If your input and/or output options have been scrambled, this command should reset them.

Office of Information Technology • Main Office: ECS 125 • Phone: 410-455-3838 • Email: oit@umbc.edu