start page | rating of books | rating of authors | reviews | copyrights

Learning the Unix Operating System

Learning the Unix Operating SystemSearch this book
Previous: 3.5 Changing Your PasswordChapter 3
Your UNIX Account
Next: 4. File Management
 

3.6 Customizing Your Account

As we saw earlier, your home directory may have a hidden file called .profile. If it doesn't, there'll probably be one or more files named .login, .cshrc, .tshrc, .bashrc, .bash_profile, or .bash_login. These file are shell setup files, the key to customizing your account. Shell setup files contain commands that are automatically executed when a new shell starts - especially when you log in.

Let's take a look at these files. Go to your home directory, then use cat to display the file. Your .profile might look something like this:

PATH=/bin:/usr/bin:/usr/local/bin:
export PATH
/usr/games/fortune
date
umask 002
stty erase ^H intr ^C

A .login file might look something like this:

set path = (/bin /usr/bin /usr/local/bin .)
/usr/games
date
umask 002
stty erase ^H intr ^C

As you can see, these sample setup files contain commands to print a "fortune" and the date - just what happened earlier when we logged in! (/usr/games/fortune is a useless but entertaining program that prints a randomly selected saying from its collection. fortune isn't available on all systems.)

But what are these other commands?

You can execute any of these commands from the command line, as well. For example, to change your erase character from [BACKSPACE] [(CTRL-H)] to [DEL] [CTRL-?] you would enter:

% stty erase ^?

(The [DEL] key actually generates the control code [CTRL-?] so that's what you'll see on your screen.)

Now pressing [DEL] will backspace and erase characters you type. (If your account is already set up to use [DEL] as the erase character, reverse this example, and change the erase character to [BACKSPACE].

If you experiment with stty, be careful not to reset the erase or interrupt character to a character you'll need otherwise. If you do, though, simply log out and then log back in; you'll get the default erase and interrupt characters again.

UNIX has many other configuration commands to learn about; the references in Appendix A list some of them. One popular configuration is to change your screen colors. On some Linux systems (and others), for example, the command setterm -background blue makes a blue background. Unfortunately, different systems do this in different ways; ask a local expert or someone who has a colored screen.

Just as you can execute the setup commands from the command line, the converse is true: any command that you can execute from the command line can be executed automatically when you log in by placing it in your setup file. (Running interactive commands like mail from your setup file isn't a good idea, though.)

You probably shouldn't edit your setup files yet, but it's good to know what's in them. Later, when you know more about UNIX, feel free to add or change commands in this file.


Previous: 3.5 Changing Your PasswordLearning the Unix Operating SystemNext: 4. File Management
3.5 Changing Your PasswordBook Index4. File Management

The UNIX CD Bookshelf NavigationThe UNIX CD BookshelfUNIX Power ToolsUNIX in a NutshellLearning the vi Editorsed & awkLearning the Korn ShellLearning the UNIX Operating System