Computer Operating Systems, Unix
Read one or more vi tutorials on the Web. Start the vi homework exercise, leaving the
resulting modified file "tutor.vi" in your "homework" directory of the Hammond Lab
Functions of an Operating System:
- Protects Itself
- Brings in and runs other programs
- Manages connection of user to program
- Manages display of information
- Assigns central memory use
- Manages Disk units
- Performs other routine input/output (I/O) functions
- Creates and copies files
- Creates file directory structures
- Lists available files
- Formats Disks
- Establishes and enforces protection levels on files and folders
- Deletes unwanted Files and Directories
- Drives you nuts, and much more
We will be using a Unix environment for this class, because Unix is the most widely used operating
system outside the PC world. When you go beyond simple spread sheet calculations, the vast majority
of Scientific and Engineering analysis is being performed on Unix Workstations. As a result, I have
found that Unix experience can be a major plus on a student's resume. You may even find value in
your Unix experience within the PC world. The freeware system Linix looks almost identical to Unix.
IBM's OS/2 has an interface that is also very similar to Unix. Microsoft's Windows NT is a
derivative of a Digital Equipment's VMS operating system, but is still very similar in many respects.
If you have used DOS on a PC you will recognize most of the material presented in class and adapt
fairly quickly. If not, you should plan on spending at least 5 hours in a Workstation Laboratory
during the next week practicing fundamentals. My lecture material is supplemented by on-line
tutorials, and laboratory help sessions (schedules to be announced).
Those of you who are used to point and click computing on Macs or basic Windows are in for a little
disappointment. For the most part, you are going to have to tell the computer what you want by
typing commands, and these commands may at first seem non-intuitive. The most commonly used
commands tend to be only 2 letter abbreviations such as "ls", "cd", "rm", and "mv" (for "list",
"change directory", "remove", and "move" respectively). This shorthand is not simply because the
creators of the operating system were lazy or attempting to create their own mysterious jargon. Unix
was created in an era when data transmission speeds were very slow and the keyboard response of
interactive terminals was generally even slower. Even marginal typists like me could over-run the
abilities of these devices to keep up with our input. Keeping commands to a minimum length kept
frustration levels for computer users to a minimum.
The first thing to realize about Unix is that it is case sensitive. It makes a difference whether you type
a command as "cd" or "CD". Unix doesn't have a clue what "CD" means. If you are having
problems logging in, check to see if the Caps Lock key has been engaged. Also note that the access
password given to you by the University should be entered as lower case letters.
The "man" Command
The most important Unix command that you will learn is "man", the abbreviation for "manual".
If I want to know more about the "ls" command I just type:
My screen will fill with the beginning of the manual pages on "ls". When I want to read more, I just
hit the space bar on the keyboard. If I've learned what I need, before finishing the full entry for "ls",
all I do is type the letter "q" to quit reading the manual page.
In the form above, "man" is will only tell you something if you already know the command name. If
you want to find information on some topic, you need to apply the "keyword" option. Options for
Unix commands are single letters preceded by a hyphen. If I want to obtain information on coping a
man -k copy
This particular example will work very well for you on most Unix machines, producing a short list of
Unix manual entries related to "copy". Currently, on the Hammond Lab machines the result is less
than satisfactory, producing a long list of commands, utilities, and routines that do some sort of copy,
but never mentioning "cp". The success of the keyword option hinges on the way the initial index
was established for the manual pages. The quality of the index varies from machine to machine.
The workstations in the Hammond Lab provide a very good environment for working with "man". To
gain experience with a given Unix command, I recommend that you use one window to open the
manual pages for that command, and use the other window to experiment with the command.
Unix file system
The purpose of any file system is to provide an organized way to store and retrieve information.
For its purposes, the basic unit of information is a file. A file can contain any amount of text,
machine language instructions, or other data. The details of its contents are generally not the
concern of the file system, although the Unix file system can track whether or not the file
contents are considered to be "executable" (a set of instructions to the computer). The file
system keeps a record of each files, name, location on disk, size, and protection status.
Organization is provided by a mechanism for bunching files into groups (subdirectories),
naming these groups, and recording a list of their contents.
The first major hurdle with any operating system is understanding how it stores and organizes your
information. For those of you accustomed to MSDOS, Unix will have few surprises. Just remember that
backslashes "\" are replaced by regular slashes "/", and that disk designators such as "A:" don't crop up
under Unix. For those of you who have used Macs, you will find that the file structure is actually very
similar. You will just have to adjust to typing the appropriate subdirectory commands and names rather
than clicking on file folder icons. For those who haven't a clue of what I've been talking about so far,
you need to take a look at my digression on organization of information.
When you first login to a Unix machine, you are placed in your "home directory". For me on the
Hammond Lab machines that would be:
Useful Unix File System Commands
Here are some commands you must learn to get around in Unix. In some cases I list command
options that will probably be useful. However, I will not provide a comprehensive list of
command options. Use the man commands if you want to know more about any of the
commands that I present in theses lectures.
- list at the contents a directory (folder).
- Three popular options for "ls" are:
- -F : show which are subdirectories, which are executable and which are normal
- -a : show files beginning with "." too
- -l : long format ( gives date, protection, and owner)
- "ls" : list the contents of the current directory
- "ls My-Stuff": list the contents of the subdirectory named "My-Stuff" located
under my current directory
- "ls ~/My-Stuff" : list the contents of the subdirectory named "My-Stuff" located
directly under my home director
- "ls -alF" list the contents of the current directory in a form very similar to the
MSDOS "dir" command.
- make a subdirectory (create a folder)
- "mkdir programs" : Make a subdirectory called "programs" under the current
- "mkdir ~/homework" : Make a subdirectory called "homework" directly under
your home directory (regardless of where you are currently located in the directory
- change your current location in the directory structure (open folder)
- "cd programs" : Switch from your current directory to one directly under it named
"programs". After this command "programs" is your current working directory.
- "cd ~/homework" : Switch your current working directory to "homework" located
directly under your home directory.
- "cd ~" : Switch to your home directory.
- "cd " : Switch to your home directory. A great way to get home if you are lost in the
maze of subdirectories.
- Print the name of the current working directory to the screen.
Unix is a layered operating system. The core of the system is called the kernal, doing all of the
detailed work of organizing and running things. You really don't want to know about these
details, and I'm not the one to teach you in any case. Wrapped around the kernal is a layer of
Unix utilities. These are the programs that process your commands such as "ls" or "cd", making
requests to the kernal as needed. The most basic of these utilities are located in the directory
"/bin". You will recognize the names of the utility program files. They are the same as the
"commands". This is no coincidence. When you type a command, you are interacting with the
outer-most layer of the operating system called the shell. If your command is not one of a very
limited number of ones internal to the shell, it assumes that you have given it the name of a
program to execute. To find that program, the shell looks through a series of directories stored
in a list called the "path" for the file with the program name. One of the first directories listed in
the path is "/bin".
Depending on how your Unix system has been configured, you may be interacting with one of
several possible shells. For this class your default shell at the time of login is the C Shell, "csh".
Two other popular shells are "tcsh" and "ksh" (Korn Shell). From time to time you may also see
references to an older one called the "Bourne Shell". Details of what you can do with input
commands vary from shell to shell, but the basic commands we will learn in this class execute
utilities independent of the shell.
Ending Your Interactive Computer Session
Recall that if you are working directly at a Unix Workstation in an Xwindows session you will need to
position the cursor on the screen background, push the right mouse button, and follow the menu chain
to log off of the machine. If you are connected to the Workstation via a telnet session, just type
"exit". Watch for messages that indicate you are really disconnected from the machine. Sometimes
you have forgotten that you are in some other relative of a shell session, and need to type "exit" again
to really get off of the computer.
You can find more information on Unix in various Web tutorials and in my answers to questions
from past class members.
Up one level / Home
Maintained by John Mahaffy : firstname.lastname@example.org