Customizing Your Working Environment
You can modify the environment variables in your system initialization files to control and adjust many aspects of your working environment. When you log in, your system reads the initialization files and uses the environment variables to configure your system. By setting the environment variables, you can customize your system to make it easier and more efficient to do your work.
This chapter describes the following tasks.
Modifying Initialization Files
The particular initialization files responsible for your system's configuration depend on which shell the system administrator has specified as your default shell when your system was first installed. The Bourne shell is the default shell for the Solaris operating environment, but you can also use the C shell or Korn shell. Each of these shells has its own initialization file (or files).
Type echo $SHELL.
$ echo $SHELL /bin/sh
Review the output of the command to determine your default shell.
Refer to the following list to identify your default shell.
Regardless of the shell you are using, when you first log in your system generally runs the system profile file, /etc/profile. This file is generally owned by the system administrator and is readable (but not writable) by all users.
After your system executes the system profile, it runs the user profile. The user profile is one (or more) initialization files that define your working environment. For example, if you're in the CDE environment your system checks this file (or set of files) each time you start a new terminal or window.
Depending on which shell is set up as your default, your user profile can be one of the following:
.profile (for the Bourne and Korn shells)
.bash_profile (for the Bourne Again shell)
.login and .cshrc (for the C shell)
.tcshrc and .cshrc (for the TC shell)
.zlogin and .zshrc (for the Z shell)
Setting Environment Variables
Your system sets up your system environment by using a set of specifications that are defined in the initialization files. If you want to temporarily modify your environment for the current work session, you can issue commands directly at the command prompt. However, if you want to modify your working environment on a more permanent basis, you can store "permanent" environment variables in the appropriate user profile files.
Type the env command and press Return:
$ env HOME=/home/user2 PATH=/usr/bin: LOGNAME=user2 HZ=100 TERM=dtterm TZ=US/Mountain SHELL=/bin/csh MAIL=/var/mail/user2 PWD=/home/user2 USER=user2 $
This section describes some of the more commonly used environment variables. Many of these variables might already be in your user profile. As previously mentioned, your user profile file is located in your home directory.
Note - To view hidden ("dot") files, use the -la options of the ls command.
CDPATH - Specifies the directories to be searched when a unique directory name is typed without a full path name.
LOGNAME - Defines your login name. The default for this variable is automatically set to the login name specified in the passwd database as part of the login process. See System Administration Guide: Basic Administration for information on the passwd database.
MAIL - Specifies the path to your mailbox, which is usually located in the /var/mail/username directory, where username is your login name. See Chapter 7, Using Mail for more information on this file.
PATH - Lists, in order, the directories that the system searches to find a program to run when you type a command. If the appropriate directory is not in the search path, you have to type it or else type the complete path name when you enter a command.
The default for this variable is automatically defined and set as specified in your user profile file as part of the login process.
PS1 - Defines your command prompt. The default prompt for the Bourne, Bourne Again, and Korn shells is the dollar sign ($). The default prompt for the C, TC, and Z shells is the percent sign (%). The default prompt for root in either shell is the pound sign (#).
TERMINFO - Specifies the path name for an unsupported terminal that has been added to the terminfo database. You do not need to set this variable for default terminals in this database. See System Administration Guide: Advanced Administration for information on the terminfo database.
TERM - Defines the terminal you're currently using. When you run an editor, the system searches for a file with the same name as the definition of this variable. The system first searches the path (if any) referenced by the TERMINFO variable, and then the default directory, /usr/share/lib/terminfo, to determine the characteristics of the terminal. If a definition is not found in either location, the terminal is identified as "dumb."