Previous Page | Next Page

  1. Introduction
  2. Abbreviated Boot
  3. The Boot Process
  4. Startup and Run Levels
  5. Initialization Scripts
  6. Runlevel Scripts
  7. Login Process
  8. Bash Shell
  9. Filesystems
  10. LILO, Kernel and Root Filesystem
  11. The Kernel
  12. Passwords, Users, Groups, and Quotas
  13. The Environment
  14. The /etc/sysconfig directory
  15. The /proc filesystem
  16. Process Control
  17. Devices
  18. Daemons Services
  19. Inetd and Network Services
  20. Programs and Libraries
  21. Security and PAM
  22. The printer services
  23. Mouse support with gpm
  24. Mail
  25. News
  26. UUCP
  27. LDAP
  28. NFS and RPC
  29. Samba, NetBIOS, WINS, nmbd
  30. Identd (auth)
  31. Telnet and FTP
  32. Apache web server
  33. DNS and named
  34. How X Works
  35. X Scripts
  36. Support for Text
  37. Keymapping for Programs
  38. Keycode Table
  39. Example Keymap File
  40. Terminfo Commands
  41. VT100 ESC sequences
  42. Kernel Revisited
  43. Configuration Files
  44. Credits

The Linux Environment

Almost any program can manipulate environment variables. The creation and manipulation of environment variables begins when the kernel loads. Further manipulation is done by the init, getty, login, and bash (or whatever shell is running) programs. If a system is configured with shadow passwords, environment strings can be set by the login program by using a file called /etc/login.defs.

The env command

To see a list of your current environment you can type "env" and output similar to the following will be produced:

USERNAME=root
ENV=/root/.bashrc
HISTSIZE=1000
HOSTNAME=mymachine
LOGNAME=root
HISTFILESIZE=1000
MAIL=/var/spool/mail/root
TERM=linux
HOSTTYPE=i386
PATH=/sbin:/bin:/usr/sbin:/usr/bin:/usr/X11R6/bin:/usr/local/java/bin:/root/bin
KDEDIR=/usr
HOME=/root
INPUTRC=/etc/inputrc
SHELL=/bin/bash
PS1=[\u@\h \W]\$ 
USER=root
QTDIR=/usr/lib/qt-2.0.1
LC_ALL=en_US
LANG=en_US
OSTYPE=Linux
LINGUAS=en_US
SHLVL=1
_=/usr/bin/env

As you can see, this command will show all your current environment variables.

Some common environment variables

See the "environ" man page or the file "unistd.h".

EDITORTells the default editor to use
HISTSIZESet by the shell program, usually bash.
HISTFILESIZESet by the shell program, usually bash. The number of lines the user's $HOME/.bash_history file can contain as a maximum.
HOMEA user's login directory.
HOSTNAMEThe network name of the host (this machine) set by the rc.sysinit script using either the /etc/HOSTNAME file or the /etc/sysconfig/network file. In modern versions of Redhat the file /etc/sysconfig/network is used.
HOSTTYPESet by the kernel, and defines the architecture of the machine.
LANGThe name of a language to use.
LOGNAMEThe user's login name as set by the login program.
MAILSet by the login program.
PAGER Used by the man command to specify the command to use to display man pages.
Ex: PAGER=less
export PAGER //exports it to the environment, Only need to use this once
PATHThe directory prefixes used to search for programs and files. Set by the shell program, scripts, and the user. This is set by login at startup, then may be modified by shell scripts.
PS1 Defines the main shell prompt
PWDThe current working directory. Set by the shell program such as bash.
SHELLThe name of the user's login shell. Set by the login program.
TERMThe terminal types for which output is to be prepared. Set by the getty program and preserved by the login program..
USERThe user's name as set by the shell program.

The chroot environment