Lecture #1 – History of UNIX

 

·        Before UNIX

 

Before UNIX, there was a major project names MULTICS.  MULTICS was a joint venture between MIT, Bell Labs and GE.  Unfortunately this project was a failure.  The operating system used too many CPU resources to be useful.

 

·        UNIX V1

 

In 1969, Ken Thompson and Dennis Ritchie created a small operating system on an old PDP-7.  In 1970 the group convinced the Bell Labs Patent Office to use UNIX as a text processing system.  The group rewrote UNIX in “C” to run on a PDP-11 computer.

 

·        UNIX V6

 

By 1975 UNIX was up to Version 6.  The CS Research Division of Bell Labs began distributing the software though UC Berkeley.  By 1980 the operating system had become very popular within the academic community because it was free and source code was available.  This academic version was called BSD (Berkeley Software Distribution) and eventually released outside of the academic world for commercial use.  SunOS was based on a BSD release.

 

Meanwhile Bell Labs was freed to release its own version of UNIX call System V for commercial use.

 

·        SVR4

 

By 1998 System V, BSD and other variations of BSD had diverged.  Bell Labs became increasingly unhappy with the variations.  Finally, Bell Labs and UC Berkeley agreed to merge the two versions into System V Release 4.  Some vendors refused (or took a long time) to accept the new merged baseline.

 

·        OSF

 

In 1990, a group of these vendors decided to merge their non-SVR4 variations info a single standard operating system.  This consortium was called Open Software Foundation (OSF).  By 1994, OSF had failed.  The software was complete but not used by any of the vendors.  A few OSF ideas survived such as MOTIF.  The IEEE tried to make a standard version of UNIX too, call POSIX.  It was also poorly received.


 

·        LINUX

 

In 1991, UNIX looked near death, but a young college student named Linus Torvalds created a mini-UNIX to teach himself low-level programming.  In 1994 Redhat released it first distribution of LINUX.  Much of the success of LINUX can be credited to the GNU open source movement.

 

Bell Labs eventually sold UNIX to a network operating company called Novell.  Novell used it for a while and then eventually sold it again.  BSD continued on outside of the merger with SVR4.  A version called OpenBSD is still available and was used in creating the new version of the Apple Mac OS-X operating system.


 

Components of an Operating System

 

·        Hardware Interface

 

The operating system provides a consistent way for applications to access devices, such as printers, terminals, disk drives, memory, etc.  The ability to make devices from a variety of suppliers act consistently to the user is called hardware abstraction.

 

·        Resource Management

 

Some devices need to be shared between multiple applications, such as memory, disks, networks and printers.

 

·        Process Management

 

To allow multiple users and multiple tasks per user to run on the same computer requires some coordination.  This includes context switching, message passing and security.  It would also be nice to have some protection such that one poorly behaved program does not affect other higher priority functions.

 

·        Kernel Interface

 

The functions listed above are generally known as the operating system "kernel". The system calls and library functions provide a means for applications to access the kernel in a controlled manner.

 

·        Applications / Utilities

 

Users can write applications using the system calls and library functions without having to understand or re-invent the internals of the operating system for each application.


 

Login / Logout / Help

 

 

·        To logout of a shell use CTRL-D or exit.

 

·        Online help can be accessed with man <command>

 

The output will be something like this:

 

 

 


 

·        In the SYNOPSIS parameters in the [] are optional.  Be careful of order.  In this example, the OPTIONS must be before the STRING. 

 

            Some options have required arguments, so a DESCRIPTION that reads:

 

                        -f  file-name      Filename to be used for input.

 

            requires the file-name anytime that a –f option is used. 

 

            Some options have optional arguments, so a DESCRIPTION that includes:

 

                        -f   [file-name]  Filename to be used for input.

 

            can have the –f option with, or without a file-name argument.

 

 

·        Some simple commands for UNIX are:

 

echo <string>                         Display a string to the terminal (p. 1066)

 

date                                         Display the date and time (p. 1063)

 

cp <oldfile> <newfile>           Copy a file (p. 1062)

 

mv <oldfile> <newfile>          Move (rename) a file (p. 1080)

 

rm <file>                                 Remove a file or files. (p. 1088)

 

mkdir <directory>                  Creates a new directory. (p. 1079)

 

rmdir <directory>                   Remove an empty directory. (p. 1088)

 

uniq <file>                              Remove duplicate lines in a files. (p. 1099)

 

sort <file>                               Lexicographically sort a file (p. 1091)

 

cat <file>                                Display a file (p. 1058)

more <file>                             Display a file one page at a time (p. 1079)

less <file>                               Display a file one page at a time (p. 1073)

 

cd <directory>                        Change working directory

 

pwd                                          Display working directory

 

ls [-l] [-a] [directory]              Display the files in <directory>.  Without a directory, display the files in the current working directory.  Use –l option for long listing, -a option for hidden filed. (p. 1077)

 

head [-count] <file>                Display first <count> lines of a file. (p. 1072)

 

tail [-count] <file>                  Display last <count> lines of a file. (p. 1093)

 

grep <string> <file>               Search a file for string, and display matching lines. (p. 1071)

 

diff <file1> <file2>                 Display differences between two files (p. 1064)

 

mail / mailx / pine                   e-mail utilities. (p. 1078 & 1082)

 

lpr <file>                                 Print a file or files (p 1077, also lp on System V)

 

passwd                                    Change your password. (p. 1082)

 

who                                          List all of the users currently logged onto this computer.

 

w                                              Similar to who but more info

 

chmod [+x] <file>                   Change file to an executable script (p. 1059)

 

 

·        UNIX does NOT warn about impending doom.  If you mv a file to a name that already exists, the old file is automatically and silently deleted.

 

mv   file1  done

mv   file2  done

 

In this example file1 is effectively deleted.

 

·        Be very careful using the * wildcard.  We will discuss this more next lecture.

 


 

vi is the standard UNIX text editor, but is not very user friendly.  It is designed to work with many different terminals and terminal emulators.  In general, you need to set your terminal as vt100. 

 

linux$  vi  <filename>

 

vi is a dual-mode editor – you start in command mode, but switch to input mode to enter new text.

 

Some simple vi commands to get you started:

 

 

<Esc>        Change to command mode

i                 Change to input mode

 

h                One character left

j                 One character down

k                One character up

l                 One character right

 

CTRL-R    Redisplay the screen.

 

x                Delete one character

dd              Delete line

u                Undo

ZZ              Save and Exit

:q!              Exit without saving

 

pico is the friendly UNIX text editor, but it is not installed automatically on every system.

 

linux$  pico  <filename>

 

All pico commands are executed by pressing the CTRL key followed by the command.

 

To exit pico press CTRL-X.