LIS508 lecture 8: looking at linux Thomas Krichel 2002-11-11.

35
LIS508 lecture 8: looking at linux Thomas Krichel 2002-11-11

Transcript of LIS508 lecture 8: looking at linux Thomas Krichel 2002-11-11.

Page 1: LIS508 lecture 8: looking at linux Thomas Krichel 2002-11-11.

LIS508 lecture 8:looking at linux

Thomas Krichel

2002-11-11

Page 2: LIS508 lecture 8: looking at linux Thomas Krichel 2002-11-11.

Structure

• History of unix and linux

• Using linux

• Free software

Page 3: LIS508 lecture 8: looking at linux Thomas Krichel 2002-11-11.

Early Computing History• In the 1940s and 1950s, all computers were

personal computers in the sense that a user would sign up to use the machine and then take over the whole machine for that period.

• The early 1960s were dominated by batch systems in which a user would submit a job on punched cards and wait, usually hours, before any printed output appeared.

Page 4: LIS508 lecture 8: looking at linux Thomas Krichel 2002-11-11.

Early Computing History• To get around this unproductive environment,

the concept of timesharing was invented by Dartmouth College and M.I.T.

• The M.I.T system CTSS (Compatible Time Sharing System) was an enormous success.

• M.I.T., Bell Labs, and General Electric created a second generation timesharing system named MULTICS (Multiplexed Information and Computing Service).

Page 5: LIS508 lecture 8: looking at linux Thomas Krichel 2002-11-11.

Early UNIX History• At Bell Labs, Ken Thompson decided to write a

stripped down version of MULTICS for the very small PDP-7 minicomputer which he called UNICS.

• Dennis Ritchie, also at Bell Labs, joined Thompson in further developments of what was now called UNIX.

• Together they ported the system the the larger and very popular PDP-11/20 and PDP-11/45 minicomputers.

Page 6: LIS508 lecture 8: looking at linux Thomas Krichel 2002-11-11.

Early UNIX History• Thompson also rewrote the operating system in

high level language of his own design which he called B.

• The B language lacked many features and Ritchie decided to design a successor to B which he called C.

• They then rewrote UNIX in the C programming language to aid in portability.

Page 7: LIS508 lecture 8: looking at linux Thomas Krichel 2002-11-11.
Page 8: LIS508 lecture 8: looking at linux Thomas Krichel 2002-11-11.

Early UNIX History• In 1974, Ritchie and Thompson published a

paper about UNIX and received the prestigious ACM Turing Award.

• This publication stimulated many universities to request a copies of UNIX.

• Since Bell Labs, part of AT&T, was not allowed to be in the computer business, it licensed UNIX to universities.

• Also, at that time, the PDP-11 series was the workhorse of most computer science departments.

• Result: UNIX was a hit on campus.

Page 9: LIS508 lecture 8: looking at linux Thomas Krichel 2002-11-11.

Early UNIX History• In Version 6, the source code of UNIX was 8200

lines of C and 900 lines of assembler.• The first portable version arrived with Version 7

which had 18,800 lines of C and 2100 lines of assembler.

• By the 1980s the use of UNIX was widespread with many vendors selling their own versions based on Version 7.

Page 10: LIS508 lecture 8: looking at linux Thomas Krichel 2002-11-11.

BSD UNIX• One of the many universities that had received

license for UNIX was the University of California at Berkeley.

• Aided by many government grants, Berkeley released an improved version named 1BSD (First Berkeley Software Distribution)

• In subsequent, versions Berkley added many new features including a new visual editor (vi) and a new shell (csh).

Page 11: LIS508 lecture 8: looking at linux Thomas Krichel 2002-11-11.

Two UNIX Versions• Because of these and other enhancements,

many companies based their UNIX on Berkeley’s version as opposed to AT&T’s so-called System V.

• By the late 1980s, two different and somewhat incompatible versions of UNIX were in widespread use: 4.3 BSD and System V release 3.

Page 12: LIS508 lecture 8: looking at linux Thomas Krichel 2002-11-11.

UNIX Standards• In addition, every vendor added its own nonstandard

enhancements.• In an attempt to unify the troops, the IEEE Standards

Board undertook the POSIX Project (POS for Portable Operating System) and IX to make it UNIX like.

• POSIX 1003.1 emerged as a common ground standard.

• 1003.1 is the intersection of System V and BSD. (a feature had to be on both to be included in the standard)

Page 13: LIS508 lecture 8: looking at linux Thomas Krichel 2002-11-11.

UNIX Standards

• The POSIX standard defined a set of library procedures and systems calls that all compliant UNIX systems.

• It appeared that the split between System V and BSD had been somewhat dealt with.

• Unfortunately, a funny thing happened on the way back form the standards meeting.

Page 14: LIS508 lecture 8: looking at linux Thomas Krichel 2002-11-11.

UNIX Standards• A group of vendors led by IBM, DEC, Hewlett-

Packard, and others formed the OSF (Open Software Foundation) to standardize an enhanced version of UNIX in an attempt to derail AT&T’s efforts to regain control of UNIX.

• AT&T, Sun, UNISYS, Data General, and other companies countered and formed UI (UNIX International) based on System V.

Page 15: LIS508 lecture 8: looking at linux Thomas Krichel 2002-11-11.

UNIX Like Systems• In a new trend, UNIX like operating systems

began to appear.• MINIX, by Andrew Tanenbaum, used a

microkernel design with only 1600 lines of C and 800 lines of assembler in its first version.

• In 1991, a Finnish student named Linus Torvalds released another UNIX clone named Linux version 0.01.

Page 16: LIS508 lecture 8: looking at linux Thomas Krichel 2002-11-11.

Linux• Linux is a monolithic design rather than a

microkernel design. (9,300 lines of C and 950 of assembler)

• Linux quickly grew in size and functionality. • Version 1, shipped in 1994, contained about

165,000 lines of code. • Version 2 in 1996 contained about 470,00 lines

of C and 8000 lines of assembler.• Linux is released under the GNU public licence

(we will cover this later).

Page 17: LIS508 lecture 8: looking at linux Thomas Krichel 2002-11-11.

In the meantime, in the trenches• In 1992, Berkeley decided to terminate BSD

development with one final free release - 4.4BSD.

• AT&T sued claiming the version contained AT&T code.

• During the lawsuit, Berkeley was not allowed to distribute 4.4BSD thus giving time for Linux to become established.

• Had the lawsuit not occurred, there would have been serious competition between two freely available.

Page 18: LIS508 lecture 8: looking at linux Thomas Krichel 2002-11-11.

AT&T’s Exit• AT&T eventually decided to focus on the long

distance telephone business and sold its UNIX business to Novel in 1993.

• In turn, Novel sold it to Santa Cruz Operations in 1995.

• But who owned this version of UNIX was almost irrelevant since so many companies already had licenses.

Page 19: LIS508 lecture 8: looking at linux Thomas Krichel 2002-11-11.

UNIX Consolidation• Even though there have been many vendors

and many version of UNIX over the last few decades, the market is now beginning to consolidate.

• IBM AIX• Hewlett-Packard HP/UX• Sun Solaris• Macintosh OS X

Page 20: LIS508 lecture 8: looking at linux Thomas Krichel 2002-11-11.

Linux Distributions

• Linux itself is free. It is packaged, provided with installation and management tools, and made available for a small fee by various vendors on CD.

• These packages are known as distributions.• Some common distributions are

– Red Hat -- SuSE --Mandrake– Debian -- Slackware

• Differences– Locations of files (configuration, binaries, etc.)– GUI– Security, efficiency, etc.

Page 21: LIS508 lecture 8: looking at linux Thomas Krichel 2002-11-11.

UNIX Philosophy• Make each program do one thing well.

– These programs are sometimes called tools.

• Expect the output of every program to be the input to another yet unknown program.– Simple tools can be connected to accomplish

a complex task

• Do not hesitate to build new tools – The UNIX tool library keeps growing

Page 22: LIS508 lecture 8: looking at linux Thomas Krichel 2002-11-11.

UNIX Philosophy• The UNIX philosophy has not proven to be

the best for all applications.– For example, there are lots of text

manipulation tools that can be put together to accomplish a complex word processing task but the trend is definitely toward integrated word processing software.

Page 23: LIS508 lecture 8: looking at linux Thomas Krichel 2002-11-11.

Layers in the UNIX System

Hardware(cpu, memory, disks, terminals, etc.)

UNIX Operating System(process management, memory management,

the file system, I/O, etc.)

Standard Library(open, close read, write, etc.)

Standard Utility Programs(shell, editors, compilers, etc.)

Users

System Interface calls

Library Interface

User Interface

User Mode

Kernel Mode

Page 24: LIS508 lecture 8: looking at linux Thomas Krichel 2002-11-11.

UNIX Structure• The kernel is the core of the UNIX system,

controlling the system hardware and performing various low-level functions. The other parts of the UNIX system, as well as user programs, call on the kernel to perform services for them.

• The shell is the command interpreter for the UNIX system. The shell accepts user commands and is responsible for seeing that they are carried out.

Page 25: LIS508 lecture 8: looking at linux Thomas Krichel 2002-11-11.

Famous shells• The Bourne shell /bin/sh (default)

• The Korn shell /bin/ksh

• The C shell /bin/csh

• The Bourne Again Shell /bin/bash

• The Z shell /bin/zsh

• In linux, /bin/sh is usually /bin/bash

Page 26: LIS508 lecture 8: looking at linux Thomas Krichel 2002-11-11.

UNIX Structure• Hundreds of applications are supplied with

the UNIX system. They support a variety of tasks – copying files– editing text– performing calculations– developing software– Serving web pages etc

Page 27: LIS508 lecture 8: looking at linux Thomas Krichel 2002-11-11.

Using Linux/UNIX

• Depends on how it is set up. The following are true on wotan, on other machines it may be different.

• Wotan runs Debian GNU/Linux.

• / is the root directory

• /home/user (aka ~user) is the home directory of the user user.

• ls –l lists files in long format.

Page 28: LIS508 lecture 8: looking at linux Thomas Krichel 2002-11-11.

Permission model

• Permission of files are give to the owner, the group, and the rest of the world.

• A group is a grouping of users. Unix allows to define any number of groups and make users a member of it.

• The rest of the world are all other users who have access to the system, including public access on a web server, for example.

Page 29: LIS508 lecture 8: looking at linux Thomas Krichel 2002-11-11.

First element in ls -l

• Type indicator– d means directory– l means link– - means ordinary file

• 3 letters for permission of owner• 3 letters for permission of group• 3 letters for permission of rest of the world• r means read, w means write, x means

execute

Page 30: LIS508 lecture 8: looking at linux Thomas Krichel 2002-11-11.

Change permission: chmod

A permission is a number– 4 is read– 2 is write– 1 is execute

• Permissions are three numbers, for owner, group and rest of the world.

• Example: chmod 764 file• Directories need to be executable to get in

them…

Page 31: LIS508 lecture 8: looking at linux Thomas Krichel 2002-11-11.

Bash features

• Bash is the default shell on wotan

• cd is a command to change directory

• File names and command names can be completed with TAB

• The command history can be activated with the arrow keys of the keyboard

Page 32: LIS508 lecture 8: looking at linux Thomas Krichel 2002-11-11.

Copying and removing

• cp file copyfile

• scp user@machine:file user@machine:file– User is a user– Machine is a machine– File is the path to a file – Of course you will need permissions here!

• rm file there is no recycling bin!!

-r flag copies and deletes recursively

Page 33: LIS508 lecture 8: looking at linux Thomas Krichel 2002-11-11.

Directories and files

• mkdir file makes a directory• rmdir file removes it• touch file

– makes a new empty file– sets the time on an existing file

• more file– Pages contents of file, no way back

• less file – Pages contents of file, “u” to go back, “q” to quit

Page 34: LIS508 lecture 8: looking at linux Thomas Krichel 2002-11-11.

Editing files

• There are many file editors available.

• I use emacs, because I am a geek.

• My students use nano. Invoque it withnano filename

• If nano in not there, try pico.

Page 35: LIS508 lecture 8: looking at linux Thomas Krichel 2002-11-11.

http://openlib.org/home/krichel

Thank you for your attention!