119117c75ab264786d5293b7f2e68488.ppt
- Количество слайдов: 27
Chapter 1 What is Unix? By C. Shing ITEC Dept Radford University
Objectives • • Understand Unix history Describe Unix components Understand Unix features Introduce vi editor
Unix Pre- History • 1960 CTSS (MIT Time-sharing system): main frame supports 30 terminals • 1965: Multics (Bell Lab, MIT, GE) –design 24/7 OS up to 300 terminals, completed in 1975
Unix Brief History • 1969 (Bell Lab out of Multics project) Ken Thompson design Unics for playing computer game – use DEC PDP-7 assembly language – machine dependent • 1973 Dennis Ritchie+ Thompson, Bell Lab – more than 90% code in 1970 Ritchie’s C language – machine independent • 1977 BSD (UC Bekeley Software Distribution – Bill Joy): Sun microsystem based • 1979 Version 7, Release 4 (SVR 4): standard version, , support PC – Used for 2 Unix branches: AT&T System V & UC Berkeley BSD
Unix Brief History – AT&T System V • 1980 (AT&T System III ): Implement different memory management algorithms • 1983 (System V copyright, restrict source code access) : virtual memory, Bourne shell, IPC: message, shared memory, semaphores • 1984 GNU (Not Unix): (Free Software Foundation-Richard Mathew Stallman): – Free Unix concept: free software – GNU GPL (General Public License-”copyleft”- open source): freedom to run, copy, distribute, study, change, improve software – More people use, debug, more secure – Free Unix version Software: GNU C, EMACS, GNU C Library, bash shell (1990) • 1984 X Window (GUI by MIT) • 1986 Minix- mini Unix for PC by Tanenbaum (Harvard) • 1988 XFree 86: Free X Window on PC
Unix Brief History – AT&T System V (Cont. ) • Other Unix System V Based Systems: – V. 2 • IBM AIX • OSF/1 – V. 3 – V. 4, 1986: Korn shell – V. 4. 1, 1990 • SUN OS (Solaris), HP/UX
Unix Brief History – Berkeley BSD (Cont. ) • BSD (Berkeley Standard Distribution): – Supports socket networking, C shell, vi – 4. 2 • Apollo – 4. 3, 1990 • SUN OS (Solaris), HP/UX – 4. 4, 1992: NSF Stop funding BSD development • Free. BSD
Linux Brief History • 1991 Linux by Linus Torvalds (Finland): reimplementation of minix (small Kernel) for intel 386 PC architecture – – using Bash shell & GNU C Unix Like, Multitasking Free download version 0. 02 from FTP catalog Linux Develop Linux based on POSIX on http: //www. kernel. org • 1992 POSIX. 1(Portable Operating System Interface): IEEE standardize API: system calls (1988) and commands (1992)
Linux Brief History (Cont. ) • 1994 Linux 1. 0 use X window: penguin bite little Torvalds – Kernel Version: main. secondary. release-update (e. g 2. 6. 18 -92. e 15) • main& secondary version # – Even #: stable version (e. g. 2. 6. xx) – Odd #: under development (e. g. 2. 5. xx) – Distribution (Kernel+Software+Tools+Documentation) #: • rpm installation: Cent. OS 7. 0 (Fedora Linux), RHEL(Red Hat), Su. SE • Dbkg installation: Ubuntu, Debian, B 2 D – GUI: X server • KDE • GNOME – Small kernel – good for embedded system: for PDA, Cell Phone, digital camera, home appliance – Use less power, require less powerful hardware to run, stable- good for server • 2002 POSIX. 2: Standard UNIX Specification (or SUS)
Open Source License • GPL: GNU, free • BSD: Berkeley Software Distribution – similar to GPL • Apache License: any modification must named Apache
Linux Disadvantage • • • Non-Profit Organization Developer Command Based Control Lack of Graphics Support Lack of gaming Application Lack of Education
Linux Small Home Server Minimum Requirement • • CPU: Pentium III-500 RAM: 512 MB Disk: 20 GB VGA RAM (for Console): use X Window 32 MB • NIC: 10/100 Mbps • VGA Card: Nvidia, ATI
Unix Components • Kernel: in RAM – System calls – Interrupts • File systems: directory structures (tree) – Directory contains filenames and location of files – Every device is a file • Process management: share – CPU: time slice 1/10 sec, round-robin – RAM: fixed size page – Disk: fixed size block(1024 Bytes)
Unix Components • I/O – Character (device) – Block (regular file) – Network (socket) • IPC (inter-process communication) – Signal: processes in same machine – Pipe: processes in same machine – Socket: processes in different machines – Client/server
Linux File name for Hardware device File name IDE disk /dev/hd[a-d] SCSI/SATA/USB disk. USB flash /dev/sd[a-p] Floppy disk /dev/fd[0 -1] Printer 25 pins: /dev/lp[0 -2] USB: /dev/usb/lp[0 -15] Mouse USB: /dev/usb/mouse[0 -15], /dev/mouse PS 2: /dev/psaux CDROM/DVDROM /dev/cdrom Tape IDE: /dev/ht 0 SCSI: /dev/st 0
Unix Features • Open system – Internal software source code are available (free or low cost) • Platform independent – From PC to supercomputer • Multi-users: round-robin between users • Multi-tasking: process (execution of a program) sharing • Virtual memory – Swap space at least 2 times of RAM
Unix Features • Simple view of devices-Files (data unit on storage) – Peripheral – Network interface – Disk • Efficient, robust, simple • Lots of Utilities: tools for users to interact UNIX – Command line interpreter: process shell command • System calls similar to library routines – Processes use system-calls to interact with Kernel • Lots of commercial software • GUI: X Window
vi/vim editor • vi filename. c (or vim filename. c) • Document: Please refer to http: //www. chem. brown. edu/instructions/vi. ht ml Slide 18
Use vi Editor • 2 modes: – Editor mode (press <esc>): make correction – Insert/open/append mode (press<i>/<o>/<a>): add text Slide 19
Use vi Editor (Cont. ) • Editor mode: (Common keys) – <h>: move left, <l>: move right, <j>: move down, <k>: move up – <0>: beginning of line, <$>: end of line – <w>: next word, <b>: previous word – <: ><n>: go to line n Slide 20
Use vi Editor (Cont. ) • Editor mode: (Cont. ) – <x>: delete character, <d><w>: delete word – <d><d>: delete line (to clip board), <Y>: copy line – <p>: paste from clip board after/below cursor – <P>: paste from clip board before/above cursor – Move cursor to line m, <d><d>, then move cursor to line n, <p>: move line m to below line n – Move cursor to line m, <Y>, then move Slide 21
Use vi Editor (Cont. ) • Editor mode: (Cont. ) • Note: put a number n before an action will repeat the action n times. For example: 10<j>: move cursor down 10 lines 10<x> delete 10 characters 10<d><d>: delete 10 lines 10<Y>: copy 10 lines Slide 22
Use vi Editor (Cont. ) • Editor mode: (Cont. ) – – <r>: replace a character <c><w> type in word<esc>: replace a word <R> type in words<esc>: replace/type over words </>type in word<enter>: search the 1 st occurrence of the word – <: ><w>: save, <: ><w><q>: save and quit, – <: ><w><q>type in filename<enter>: save to filename and quit – <: ><s></><word 1></><word 2></><enter>: substitute the 1 st occurrence of word 1 for word 2 – <: ><1><, ><$><s></><word 1></><word 2></><g><enter>: substitute all the occurrence (globally) of word 1 by word 2 from line 1 to last line Slide 23
Use vi Editor (Cont. ) • Editor mode: (Cont. ) – <J>: join the cursor line and the line below into one line – Move cursor to position <i><esc>: split at the cursor position into 2 lines – <. >: repeat the previous command – <n>: next searched word – <G>: go to last line – <ctrl><g>: file status Slide 24
Use vi Editor (Cont. ) • Insert/open/append mode: (Common keys) – <i>type in words<esc>: insert words before the cursor – <a>type in words<esc>: append words after the cursor – <o>type in words<esc>: open lines after the cursor and append words – <O>type in words<esc>: open lines before the cursor Slide 25 and append words
Class Example • Hands On Example 0: edit the following 2 lines in file. exrc (vi ~/. exrc) : abbr #b /************ : abbr #e ************/ Then when you use vi template. c And after press<i>/<a>/<o> to insert text, you type #b followed by <Enter>, you add a line /**** in. Similarly, when you type #e followed by <Enter>, you add a line ****/ in • Example 1 Slide 26
Reference • Unix History: Chapter 16 • Unix internal: Chapter 14 • Linux How-to Documentation: www. tldp. org • Linux: www. study-area. org
119117c75ab264786d5293b7f2e68488.ppt