Figure 6.1: Sample printenv output

Environment variables are one way to configure the system. For example, the EDITOR variable lets you select your preferred editor for posting news, writing e-mail, and so on.

Setting environment variables is simple. For practice, try customizing your shell’s prompt and your text file viewer with environment variables. First, let’s get a bit of background information.

man less

This command lets you view the online manual for the less command. In order to show you the text one screenful at a time, man invokes a pager that shows you a new page of text each time you press the space bar. By default, it uses the pager called more.

Go ahead and glance over the man page for less, which is an enhanced pager. Scroll to a new page by pressing space; press q to quit. more will also quit automatically when you reach the end of the man page.

export PAGER=less

After reading about the advantages of less, you might want to use it to read man pages. To do this, you set the environment variable PAGER.

The command to set an environment variable within bash always has this format: