Customizing your environment
Your shell environment affects many things you may do or want to do in the shell. You have certain defaults, starting with which shell you chose at signup time, or changed to later. You can see what you have with a couple of useful commands:
- printenv
- /usr/bin/printenv prints out set environment variables. This is a very useful thing to check if something is not behaving the way you expect.
- locale
- /usr/bin/locale tells you what character set you are using. Check this if you are seeing odd characters in your documents.
Some useful environment variables
Some environment variables are probably best left at their defaults. If you change them, it may break things now, or in the future. Among these are
- HOME - contains your home directory.
- MAIL - contains the path to your maildir directory. This is your inbox, and possibly additional folders.
Some environment variables you might want to change
- PATH
- EDITOR
- Determines which text editor is invoked by other programs, such as your mail program. For historical reasons, this can be overridden by the VISUAL variable.
- TERM
- The TERM setting sets what terminal emulation you are using. There are a bewildering array of terminal emulations. New accounts at Panix default to 'xterm'. The most common reason for changing is that you want no color, or more colors, with the most colorful option being xterm-256color.
- MAILCHECK
- This determines, in seconds, how often to check for new mail.
- HISTSIZE
- This determines the size of your command history.
- SAVEHIST
- How much command history to save to file so it is available to subsequent logins.
- HISTFILE
- Where to save your command history, if you are saving it.
- MAILER
- What mail program to use when invoked from another program. Common mailers include mutt and alpine
- PAGER
- Pagers deal out one screenful of text at a time, so large output does not scroll past. The usual options are more or less
-
- PROMPT
- Sets the format for your command prompt. The specifics vary from one shell to the next. Default prompts are typically minimalist - either '>' or '%'. You can alter this to display far more information, such as your current working directory, the exit status of your last command, the time, etc.
- NEWS
- What news (usenet) program to use when invoked from another program.
- LANG
- LANG sets most of your locale options. To reduce this complicated subject to something we can usefully put on this page, your locale determines how a set of 7, 8, 16, or 32 bit numbers get mapped to characters on your screen. The default mapping is "C". This is the "enforced by grousing" standard for usenet postings. If you spend any time reading content from websites in your shell environment, you will likely find it woefully inadequate to the task. If this is the case, the most useful setting these days (for those in the English speaking world in North America), is en_US.UTF8. You can find a bunch of other locales in /usr/share/locale.
-
Your path is a colon-separated list of locations where you want to look for
executable programs and scripts. The default PATH is
/usr/local/bin:/bin:/usr/bin. The most common thing
you might want to do with that is append or prepend a directory in
your HOME, e.g. $HOME/bin.
This brings us to the question of how to set these environment variables, and where.
The commands to set an environment variable
For users of Bash, Bourne shell (/bin/sh), flavors of Korn shell (ksh, ksh93), and Z shell (zsh),
the command to set or reset an environment variable is
export VAR=value, e.g.
export EDITOR=vim
For users of C shell (csh) or TC shell (tcsh), the command to set or reset an environment
variable is
setenv VAR value, e.g.
setenv MAILER mutt
Where to set environment variables so they're still set when you next log in
Each shell has its own set of files that it reads for setting variables. Some shells have many files for specialized circumstances. For the purposes of this page, we're concerned with 2 per shell. One will set a variable at login, and that value will be propagated to all subshells. The other is read by subshells, although people often make them interchangeable by sourcing the latter in the former.
Last Modified:Thursday, 10-Sep-2026 16:22:30 EDT
© Copyright 2006-2021
Public Access Networks Corporation