O'Reilly logo

Learning the UNIX Operating System, Fourth Edition by Jerry Peek, John Strang, Grace Todino

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

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?

  • The line with PATH= or set path = tells the shell which directories to search for UNIX commands. This saves you the trouble of typing the complete pathname for each program you run. (Notice that /usr/games isn’t part of the path, so we had to use the absolute pathname to get our daily dose of wisdom from the fortune command.)

  • The umask command sets the default ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required