Introductie Linux/UNIX
Erik Poll Martijn Warnier http://www.cs.kun.nl/~erikpoll/Linux
Concrete doel van vandaag
Basisvaardigheden UNIX/Linux werken met de command line shell file beheer proces beheer
Betere indruk van wat een operating system nou eigenlijk doet “onder de motorkap kijken”
Wat is/doet een operating system?
beheert alle resources van de computer CPU, geheugen, disk, CD, beeldscherm, modem
beschermt alle resources
beheersen van complexiteit
abstraheert van onderliggende details uniforme interfaces voor allerlei randapparatuur
Het operating system (OS)
OS CPU
muis
scherm
keyboard
disk
cd/dvd
modem
geheugen
OS biedt een interface van system calls (API) die abstraheert van de onderliggende randapparatuur, bijv creer file, schrijf in file, ... lees karakter van keyboard, schrijf karater naar scherm
maar OS abstraheert niet van de machinecode van de CPU (Dit zou wel kunnen; bijv. Java)
Hoe ziet een applicatie-programma het OS? applicatieprogramma system call
OS CPU
geheugen
scherm
keyboard
cd/dvd
modem
disk
Hoe ziet een gebruiker het OS ? gebruiker
Window manager
(bijna) niet !
applicatie-programma
OS CPU
geheugen
disk modem
UNIX voor mainframes (70's) Eerste succesvolle volwassen OS interactief multi-tasking multi-user geschreven in hogere programmeertaal C
traditionele UNIX omgeving user (uid) terminal (tty) UNIX mainframe
OS voert processen (met pid's) uit voor verschillende users (met uid's) die aan verschillende ASCII terminals (tty's) werken
Centrale UNIX abstracties UNIX is georganiseerd rond de noties proces (proces = programma in uitvoering) file op het virtuele file systeem (UNIX probeert zoveel mogelijk dingen als file te beschouwen)
Succes van UNIX
bestaat al 30 jaar, ondanks revoluties in randapparatuur CPU snelheid geheugen grootte
dankzij: goedgekozen abstracties
Rest vd dag werken met de shell proces beheer file beheer X windows scriptjes: programmeren met de shell
De shell
De command line shell kale, maar krachtige interface tot het OS lijkt op MS-DOS, maar kan veel meer
de shell is een programma, dat invoer van gebruiker vertaalt naar opdrachten voor het OS
Waarom werken met de shell? handiger voor sommige taken dan GUI manier om OS te observeren zonder dat window systeem aspecten verbergt shell hetzelfde op alle UNIX/Linux systemen over netwerk zul je met de shell moeten werken het is gewoon leuk
Het file systeem
Het UNIX file systeem /
/dev
/home
/home/infstud
/usr
/tmp
/usr/bin
/home/infstud/inf099 alias ~info99
Unix file systeem Belangrijke paden Je home-directory /home/infstud/inf099 oftewel inf099~ oftewel ~ (net zoiets als “Mijn Documenten”) De wortel van het file-systeem /
NB / ipv \
Processen
Proces centraal begrip in de informatica: alles is onderdeel van een proces belangrijk(st)e taak van het OS: de illusie creeeren dat we een computer hebben met onbeperkt aantal CPU' s en onbeperkte hoeveelheid geheugen, die meerdere processen tegelijk kan uitvoeren; oftwel multi-tasking
Waarom multi-tasking ? Oorspronkelijk: dure CPU optimaal benutten met meerdere gebruikers Nu: dure gebruiker optimaal benutten
Het file systeem, vervolgd
File attributen
-rw-r--r-- inf099 infstud 9180 Oct 28 13:59 practicum.pdf lees/schrijf/execute permissies -rw-r--r-eigenaar
inf099
groep
infstud
grootte
9180 bytes
tijdstip van laatste wijzing
Oct 28 13:59
naam
practicum.pdf
UNIX filosofie: alles is een file UNIX probeert zoveel mogelijk dingen als file te beschouwen devices zijn pseudo-files in /dev; bijvoorbeeld /dev/pts/3 is een (virtuele) terminal de in- en uitvoer van programma zijn files, nl. stdin en stdout; daarom gaat > zo makkelijk !
X windows
X windows verzorgt grafische uitvoer naar het scherm X windows draait als een server processen die grafische uitvoer willen tonen op het scherm zijn de clients
X windows architectuur
window manager (bijv Gnome of KDE) X server
Linux/UNIX OS (de kernel) CPU
geheugen
disk
cd/dvd
modem
Microsoft Windows architectuur
Window OS incl. window manager
CPU
geheugen
disk
cd/dvd
modem
X windows vs MS windows
X windows geen onderdeel van het OS, maar losse utility als window manager crasht (of hangt), dan crasht de rest van het OS niet mee! keuze uit verschillende window managers, bijv Gnome of KDE
netwerk transparant
Microsoft Windows vs Linux
Voordelen MS Windows
gebruiksvriendelijker, in gebruik & installatie maar Linux GUI worden steeds beter, en Linux installatie wordt steeds eenvoudiger
sommige superieure applicaties, bijv. PowerPoint de rest van de wereld stuurt me files in .doc, .ptt, etc. format... :-(
Voordelen Linux gratis & open source veel gratis & open source applicaties minder last van virussen
meer controle & keuzevrijheid onder de motorkap van GUI kijken of: teveel keuzevrijheid ?
betrouwbaarheid
(Waarom) zouden jullie Linux willen gebruiken ?
Ervaringen van mensen die Linux al gebruikt hebben ...?
Wat hebben we niet gedaan installatie
systeembeheer als root: useraccount aanmaken disks mounten