The inside of Athena Unix
A. Course Outline
1. Advanced use of the UNIX shell
2. The internal workings of the mail system
3. The notes teleconferencing system
4. Networking
5. Distributed File Systems
6. Security
7. Kernel
8. The Ingres Database
9. System Administration
B. UNIX from the system’s point of view
1. Jobs, Programs and Processes
a. What is a program?
A program is a sequence of instructions or commands which tell the computer how to accomplish a given task. Under UNIX, this can either be a program which has been compiled, or it may just be a sequence of commands that you would normally issue to accomplish the task. The latter type of program is often called a shell script.
b. What is a process?
A process is an invocation of a program. If you run finger twice, each time you ran it, a new process was created.
c. Programs and processes encountered when logging in
1. getty
This process sits watching a terminal until someone types something. When someone does, it starts a login process. Getty runs underneath another process called init.
2. login
When login is first called, it is given the username which you typed into getty. It then asks for your password, checks it, and if correct performs the steps of logging you in. These include updating the wtmp and utmp files (Who is loged in), starting a shell (or whatever is listed in you /etc/passwd entry), giving your process the correct groups, and setting ones UID correctly. If the password was incorrect (or if the user ID is invalid), login will ask for your user id again.
3. init files
Once your shell has started, it reads several files from which it executes commands. If you are running the cshell, .login and .cshrc are executed. If you are running the bourne shell, .shrc and .profile are run.
d. What is a job?
The definition of job is not very clear. In many cases you will see the term used instead of process. Another common use of the term job is as a „session“. In other words, everything being done by a given user from a given terminal.
2. Programs v. System Calls
One distinction which I want to make clear that is very important in understanding UNIX (or any other operating system for that matter) is the difference between a command and a system call. A command in UNIX is usually a program which does something. The command, in turn, executes system calls which actually perform the actions.
D. The Shell
The following commands are built into the shell. They are different than must Unix command in this respect since command such as cp and rm are actually separate programs.
1. Shell Commands
. alias – Declare an alias for a command
. bg – Run a process in background
. cd – Change directory
. eval – Evaluate an shell expression
. exit – Exit the shell (killing it – must not be login shell)
. fg – Run a process as your foreground process
. history – Display recently executed commands
. jobs – List processes which are children of the shell
. kill – Kill a process
. logout – Log out
. nice – Run a command with a higher niceness
. rehash – Reinitialize table of commands
. set – Set a shell variable
. setenv – Set an environment variable
. source – Take commands from a file
. stop – Stop a process
. suspend – Stop the shell
. umask – Set default value for protection
. unalias – Remove an alias
. unset – Unset a shell variable
. unsetenv – Unset an environment variable
- Unix Course: Introduction, Shell Commands – Lecture 1
- Unix Course: The Shell, and Shell Programming – Lecture 2
- Unix Course: More Shell Programming – Lecture 3
- Unix Course: Unix Security – Lecture 4