The shell is the way you interact with the operating system (and
therefore the computer). It is the basic program that allows you to isse
other commands to the computer. There are several types of shell, the
most common ones are bash and tcsh. When you start a shell
(usually after logging on in the system, or by opening an xterm in
X-windows), some setting are done by the system, but you can change
them. I explain below how to make those changes, but an important warning: if your set up is wrong you
might not be able to execute programs or even log on in the system any
more, so be careful with the changes you do. In case you run into
serious trouble contact the system administrator for help.
Some of the things you can set up
Here is a (partial) list of environment variables, and a brief explanation of what they do, you can set up:
There is a standard PATH set up for you in the system, which includes most directories with executable files. Common directories are /bin, /usr/bin and /usr/local/bin, but there are many other places where executables are found.
tar tvf package.tar | lessHowever, if the LESSOPEN variable is correctly set up, the above stuff can be done in one single command with:
less package.tarThe less programm will know that it has to use tar to read the file.
To know which shell you are running, you can simply do
psand see whether bash or tcsh comes up.
ypmatch my-logging-name passwdand look at the end of the output. To find out your environment variables type either env or set
The system setting are in the file /etc/profile.
You can set up variables while working (and the setting will function only until you exit the session) or permanently (in the file .bash_profile or .bashrc). The following commands are for a working session; copy them in .bash_profile and .bashrc (to be sure that they work) for permanent changes. The lines below are examples, modify them according to your taste and needs.
export PATH=/usr/bin:/bin:/usr/local/bin:$HOME:.will search for commands in the following directories, in the given order:
export LD_LIBRARY_PATH=/usr/lib:/usr/local/lib:/home/pablo/libwill search for libraries to execute commands (not for executable commands, just the libraries) in
LD_LIBRARY_PATH=/home/pablo/lib:/lib:/usr/lib:/usr/local/lib:/usr/src/linux-1.2.3/lib:/usr/src/linux-1.2.3/arch/alpha/lib:/usr/src/linux-1.2.3/arch/sparc/lib:/usr/X11R6/lib:/var/X11R6/lib:/var/lib:/var/X11/lib:/var/openwin/libPretty complicated, as you can see, so better do not change this variable.
export TERM=vt100is a good choice when you telnet to some machine that does not recognize your term (for example, the TERM linux is not recognized in Sun machines).
export PAGER=lessis my prefered choice.
export TEXINPUTS=.//:/usr/share/texmf//will search for input files (for TeX, LaTeX, etc) in all subdirectories/files of the current directory (indicated by a . above) and then in all subdirectories/files of /usr/share/texmf The double slash (//) means precisely that, to search in the directory given and all subdirectories (so, it is like the PATH environment but with subdirectories searched as well).
export LESSOPEN="|lesspipe %s"will make the command less to work as explained above.
export LS_OPTIONS=--color=autowill put colors in the result of ls depending on whether the terminal supports them or not.
export TMOUT=180will exit the shell if I do not type anything in three minutes (180 seconds). A value of 0 will never log you out.
export PS1="\h [\w\ >"will make my prompt look like
ahlfors [/usr/local/bin] >when I am in the directory /usr/local/bin in the host called ahlfors.
export PS2=">> "will produce to > symbols and a space when I do for/while looks in an interactive shell.
The system files are /etc/csh.login and /etc/csh.cshrc
Your own files are .tcshrc, .cshrc and .login
The commands for tcsh corresponding to the above ones are as follows:
setenv PATH /usr/bin:/bin:/usr/local/bin:$HOME:.
setenv TERM vt100
setenv PAGER less
setenv TEXINPUTS .//:/usr/share/texmf//
setenv LESSOPEN "|lesspipe %s"
setenv LS_OPTIONS "--color=auto"
setenv TMOUT 180
setenv PS1 "\h [\w\ >"
setenv PS2 ">> "