Download presentation
Presentation is loading. Please wait.
1
UNIX - Introduction UNIX an Operating System Master Control Program UNIX a name of a culture UNIX a set of tools for smart people UNIX easy to use, difficult to learn
2
Other Operating Systems MVS for IBM mainframes VMS for Digital mainframes DOS or Windows for IBM-PC’s UNIX for a wide range of hardware from PC’s to mainframes –AIX from IBM –HP-UX from HP –SUNOS, SOLARIS from Sun –ULTRIX from Digital –A/UX from Apple –Minix from Tanenbaum, –LINUX –POSIX from IEEE Standard Group 1003
3
History of UNIX MULTICS –Multiplexed Information and Computing Services Operating system for a GE 645 to serve all of Boston in mid 60’s. Cooperative effort by GE, Honeywell, NCR, Bell Labs and universities UNICS –Uniplexed Information and Computing Services Ken Thompson, Bell Labs (Late 60’s) Personal effort for a PDP-7 (64 KB), later for a PDP-11 Uses language B, which was derived from BCPL by Martin Richards In 1973 Ken Thomson and Dennis Ritchie develop typed language C The C Programming Language, Reference Manual 1978 ANSI C, starting 1983
4
UNIX Name copyright of AT&T. UNIX sold to universities at minimal cost Universities dissect UNIX and train new users Computer Systems Research Group at Berkley: Supported by DARPA, make significant changes to UNIX and distribute it as Berkley Software Distribution 1 BSDfor PDP-11 2 BSD 3 BSD 4.1 to 4.4 BSD provides support for virtual memory, networking, TCP/IP
5
Most popular version 4.32 BSD. Computer System Research Group dissolved in 1993, due to cut in funding. Versions of UNIX after AT&T was broken up and allowed to sell software: UNIX System IIIMultiuser (not successful) UNIX System V developed with Sun Micro System UNIX System V, Release 4 SVR4 and 4.3 BSD not compatible AT&T issues SVID (System V Interface Definition) to keep vendors in line, BSD camp ignores it.
6
Recent history UNIX System Laboratories (USL) set up by AT&T IEEE Standard Board tries to mend rift between SVR4 and 4.3 BSD by creating POSIX (Portable Operating System) New rift between AT&T and IBM –IBM, DEC, HP and others set up Open Software Foundation –Accept IEEE standards, but add additional ones for Windowing systems, X11 from MIT Graphical interface, Motiv Distributed computing etc. 1993 AT&T sells USL to NOVELL 1995 UNIX sold to Santa Cruz Operations Inc. and HP
7
The keyboard and ASCII b 6 b 5 b 4 b 3 b 2 b 1 b 0 b 6 b 5 = 00control code = 01 special character or digit = 10 upper case = 11 lower case Control Codes: CC Communication Control FE Format Effector IS Information Separator
11
Control Codes Used by UNIX Unix CodeUsual KeyPurpose intr^CStop running program eof^Dno more data erase^Herase last character werase^Werase last word kill^Uerase entire line stop^Sstop output to screen start^Qstart output to screen
12
Setting of keys stty –agives listing of key settings stty erase ^H either hold down control key or type 2 characters: ^ and H stty kill k will kill input line on typing k not a good idea! stty intr ^? Interrupt assigned to escape key
13
Carriage return ^M and linefeed ^J UNIX stores single linefeed ^J in file to indicate end of line DOS stores carriage return and linefeed ^M^J in file to indicate end of line Return key generates ^M
14
Example of UNIX and DOS files This is a test
15
Internal representation In UNIX 15 bytes –54 68 69 73 0A 69 73 0A 61 0A 54 65 73 74 0A In DOS 19 bytes –54 68 69 73 0D 0A 69 73 0D 0A 61 0D 0A 54 65 73 74 0D 0A
16
DOS file in a UNIX editor This^M is^M a^M Test^M
17
UNIX file displayed under DOS This is a Test
18
Translation on Input and Output UNIX wants to treat input from terminal and from a file the same When file was created ^M was translated into ^J On output UNIX translates ^J into ^M^J
19
Entering Commands % who am I – Return, Enter or ^M –Until is pressed command can be edited with ^H, ^W, ^U –When UNIX receives ^M it translates it into ^J and UNIX starts executing command –Input is echoed to screen with ^J translated to ^M^J
20
Login and Logout commands login userid - initiates new login ^D – logs out when given a command to login shell logout passwd – changes your password
21
File-Related Commands cat file … cp file1 file3 cp file … dir more file mv file1 file2 mv file … dir rm file
22
Directory-Related Commands cd dir pwd mkdir dir rmdir dir ls op [file … ]
23
Informational Commands date finger name look prefix man cmd who w
24
Permission settings - chmod -rwxrwxrwx Position 1 is file type Positions 2,3,4 are permissions of u (user) Positions 5,6,7 are permissions of g (group) Positions 8,9,10 are permissions of o (other) % ls –l hmk -rwx--x--x 1 bermanka faculty 129 Jul 24 14:11 hmk % chmod a+r hmk % ls -l hmk -rwxr-xr-x 1 bermanka faculty 129 Jul 24 14:11 hmk
25
Standard Files stdinStandard input (default keyboard) stdoutStandard output (default screen) stderrStandard error messages (screen)
26
Definition of Filter A program or command is called a filter if it uses standard input and standard output. Most trivial example: cat sends stdin to stdout Other examples: cut, less, more,… Not a filter: ls, w, who, …
27
Redirection of Input and Output < filename take standard input from that file > filename send standard output to filename Examples: –ls > myfiles –more < myfiles –cat myfilestoo
28
Redirection of stdout can destroy existing files! Use set noclobber to prevent accidental overwriting If you want to overwrite an existing file ls >! names >> will append to an existing file
29
Redirection of stdin sort < file1 same assort file1 but sort file1 file2 has a different meaning it will merge the files. mail alex < memo Will send file memo to user alex
30
List of useful filters cat copy standard input to output colrmremove specific columns cryptencode or decode with a key cut extract selected columns or fields fmtformat to fit 72 characters per line grep extract lines with a specific pattern headextract first few lines of a file
31
Useful filters continued lessdisplay file – similar to more display file nlcreate line numbers paste combine columns of data pgdisplay file – similar to more rev reverse order of characters sort or merge data spellcheck spelling of words
32
Useful filters continued tailextract lines at end of file trtranslate selected characters uniqlook for repeated lines wccount number of lines, words or characters tee duplicates standard input
33
The UNIX pipe ls | more Same as ls > temp more < temp rm temp
34
Using the tee utility % who | tee who.txt | grep berman
35
Shell scripts File containing sequence of UNIX commands Created in vi or emacs: #!/bin/csh echo My name is Kenneth Berman echo My user name is $user
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.