In this lab you will customize your login environment to suit your needs
and preferences. By modifying environment variables and editing your .bash_profile
and .bashrc files, you will customize your shell environment in a number of
If you get stuck, have a question or want to share something you learned with this lab then use the CIS 90 Forum at
Log on to Opus and start this lab from your home directory.
- Display the contents of your PWD environment variable. Change to your bin
subdirectory and display the same variable. How did it change?
- Change back to your home directory.
- Display the contents of your PATH environment variable. Note the colon (:)
separating the different directory names. What is the last directory in which
the system searches for commands?
- Make a new environment variable called GREETING and assign it an appropriate
salutation. Don't forget to use quotes if your message has whitespace in it.
- Use the env command to see if it is in your environment.
Is it there? What must you do to put it in the environment?
- Export the variable GREETING and use env to verify it's there.
- Invoke a new bash shell process by typing:
Now use the unset command to unset the variable PS1.
- Reset the PS1 variable by entering the following command:
PS1="Yes master: "
What happens to your primary prompt?
- Now exit out of the child shell by typing Ctrl-d. What is the prompt now? What does this
tell you about the effect changes made by children have on their parents?
- Try to exit from your login shell by typing Ctrl-d
This is a shell feature that protects you from accidentally logging out. You can turn it off using the
set +o ignoreeof
Type the above command and then try to exit the shell with Ctrl-d
.bashrc and .bash_profile
Aliasing is a mechanism provided by the bash shell that allows you to define
your own commands, or to redefine UNIX commands. Alias definitions should be
stored in your .bashrc file.
- Edit the .bashrc file in your home directory by adding the following
three lines to the bottom of the file:
alias rm="rm -i"
alias bill="cd /home/cis90ol/$LOGNAME/poems/Shakespeare"
Note that there is no UNIX bye or bill commands.
, like your .bashrc
file, is a shell script that is
run once each time you log in. It establishes your working environment by
defining environment variables, setting your terminal type and setting other
shell characteristics, like ignoreeof
- Edit your .bash_profile and make the following changes:
- Replace the directory, $HOME/../bin with the directory, /home/cis90ol/bin
in your PATH environment variable.
- Change the command that sets your umask to: umask 006
- Below the umask command line, turn messaging off with the command:
- Add a shell environment variable named, BIRTHDAY and set it equal
to the date of your birth using the form mm/dd/yy.
Export this variable, since you will want your children to know when your
- At the bottom of the file add as the last line:
- Now that you have made these changes, run your .bashrc file using
the UNIX dot source command:
- Try out your new rm command by removing some file you
don't need anymore.
- run your bill command. What happens?
- Try out your bye command.
When you log back in again, you should be confronted with a riddle.
Try out the riddle and then submit your lab by following the instructions below.
To turn in your lab, combine your .bashrc file, your .bash_profile file,
and the output of the env command into a new file called
lab10.$LOGNAME. Then copy this file as follows:
cp lab10.$LOGNAME /home/rsimms/turnin/