Running Commands from the Shell
computer software
Running Commands from the Shell Running Commands from the Shell
Running Commands from the Shell   Home | Site Map | About Us | Products | Services | News | Contact Us | Links Running Commands from the Shell
Running Commands from the Shell Running Commands from the Shell

Copyright © 2009

Linux® Bible


TABLE 2-7
Common Shell Environment Variables
Variable
Description
BASH
Contains the full path name of the bash command. This is usually /bin/bash.
BASH_VERSION
A number representing the current version of the bash command.
EUID
This is the effective user ID number of the current user. It is assigned when the shell
starts, based on the user's entry in the /etc/passwd file.
FCEDIT
If set, this variable indicates the text editor used by the fc command to edit history
commands. If this variable isn't set, the vi command is used.
HISTFILE
The location of your history file. It is typically located at $HOME/.bash_history.
HISTFILESIZE
The number of history entries that can be stored. After this number is reached, the
oldest commands are discarded. The default value is 1000.
HISTCMD
This returns the number of the current command in the history list.
HOME
This is your home directory. It is your current working directory each time you log in
or type the cd command with any options.
HOSTTYPE
A value that describes the computer architecture on which the Linux system is
running. For Intel-compatible PCs, the value is i386, i486, i586, i686, or something
like i386-linux. For AMD 64-bit machines, the value is x86_64.
MAIL
This is the location of your mailbox file. The file is typically your username in the
/var/spool/mail directory
.
OLDPWD
The directory that was the working directory before you changed to the current
working directory.
OSTYPE
A name identifying the current operating system. For Fedora Linux, the OSTYPE value
is either linux or linux-gnu, depending on the type of shell you are using. (Bash
can run on other operating systems as well.)
PATH
The colon-separated list of directories used to find commands that you type. The
default value for regular users is /bin:/usr/bin:/usr/local/bin:/usr/
bin/X11:/usr/X11R6/bin:~/bin
. You need to type the full path or a relative
path to a command you want to run that is not in your PATH.
For the root user, the value also includes /sbin, /usr/sbin, and
/usr/local/sbin
.
PPID
The process ID of the command that started the current shell (for example, its parent
process).
PROMPT_COMMAND
Can be set to a command name that is run each time before your shell prompt is
displayed. Setting PROMPT_COMMAND=date lists the current date/time before the
prompt appears.
PS1
Sets the value of your shell prompt. There are many items that you can read into your
prompt (date, time, username, hostname, and so on). Sometimes a command requires
additional prompts, which you can set with the variables PS2, PS3, and so on.
continued
61
Running Commands from the Shell
2