Shells,
Processes
and how to get
on-line help
Each user is put in a "shell" when they log in and this protects
them from other users - who are also inside a shell. There are
different varieties of shell, which come with their own languages.
The Unix machines by default use one called
bash,
but another previously well-used one is
tcsh - and ksh and zsh might also be worth a look if you wish to change your shell.
When you log in, your shell consults a startup file in your home
directory; it is ~/.tcshrc for tcsh, and ~/.bashrc for bash. This
file sets various "environmental variables" which govern the way your
commands are interpreted. One of the most important is your PATH
variable. This specifies a list of directories where Unix will look
for the programs you try to run. To find out what's in your path,
type
If you try to run an executable program which is in a directory
that's not in your path, the system won't find it. (So rather than
there being a problem with your progam e.g. "My program won't run."
it may be a "problem" with your path.) To run the program in this
case, the simplest thing to do is to move to that directory and
type
Alternatively, you can change your path variable; e.g. (with tcsh)
- setenv PATH ${PATH}:<new-directory>
NB - if you have a "." in your path, the system will look for files in
your current working directory. (Type "pwd" at the prompt to see what
this is). This is a possible security risk - always make sure the "."
is at the
end of your path.
You can customise / personalise your shell by editing your .tcshrc
or .bashrc files to change the value of your environmental / built-in
shell variables whenever you log in, and also to create your own
variables and aliases. But please DO NOT edit these setup files until
you are ABSOLUTELY sure you know what you are doing. Errors in this
file may prevent you from being able to log in.
When you "run" an "application", the Unix operating system starts a
"process" for it. You can get a listing of processes running on a
machine - it is generally not the sort of information you would want a
malicious user to see, and some systems may not permit it.
However, it
is information you will need if you are having
problems with a process e.g. running a program with an endless loop -
you will need the process id (PID) to kill off that process. Try :-
ps
ps auwx | grep $USER
ps auwx | grep -v root
Many of the machines in the department are "multi-user" machines,
which means that several users can run processes on them at the same
time. On a multi-user system, users must "contend" with other users
for resources; if one user is running some compute-intensive program,
all the other users' processes will run slower as a result. This is
mostly managed by the operating system but only if the running processes
are behaving nicely. If you expect that your job will run for a long time,
and use up a lot of resources, then you should lower its priority, so that
it will only grab resources when no other processes need them. To do this,
use the command "nice" (type "man nice" at the command line for help about
how to use this command). Also, consider running jobs like this in the
background. To do this, type the "&" symbol after the command you want to
run before hitting 'return'.
You can mostly get information about how to do what you want if you
Read The Friendly Manual. There is a unix command "man" (short for
manual) which you can use to get information - just try typing
man man
at the command-line prompt.
For example, suppose you want to look at what files you have in your
home directory. If you type
man -k files
you will get a whole lot of information. Probably too much. It is probably
a good idea to "pipe" (using the "|" symbol) the output of a command which
is going to write a lot of commands to the terminal though the "more"
command so that you can scroll through the output page by page. IE
man -k files | more
You could also use "apropos files".
Or, you could try running an application with the parameter "--help"
(or "-h" or "-help" depending on what the programmer who wrote the
application has done).
You could also try typing "help" at the command-line prompt.