ITR3 lecture 7: more introduction to UNIX Thomas Krichel 2002-11-05.
-
Upload
jack-hoover -
Category
Documents
-
view
212 -
download
0
Transcript of ITR3 lecture 7: more introduction to UNIX Thomas Krichel 2002-11-05.
![Page 1: ITR3 lecture 7: more introduction to UNIX Thomas Krichel 2002-11-05.](https://reader036.fdocuments.net/reader036/viewer/2022082917/5514d9ad55034693478b53df/html5/thumbnails/1.jpg)
ITR3 lecture 7:more introduction to UNIX
Thomas Krichel
2002-11-05
![Page 2: ITR3 lecture 7: more introduction to UNIX Thomas Krichel 2002-11-05.](https://reader036.fdocuments.net/reader036/viewer/2022082917/5514d9ad55034693478b53df/html5/thumbnails/2.jpg)
ze olde 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 3: ITR3 lecture 7: more introduction to UNIX Thomas Krichel 2002-11-05.](https://reader036.fdocuments.net/reader036/viewer/2022082917/5514d9ad55034693478b53df/html5/thumbnails/3.jpg)
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 4: ITR3 lecture 7: more introduction to UNIX Thomas Krichel 2002-11-05.](https://reader036.fdocuments.net/reader036/viewer/2022082917/5514d9ad55034693478b53df/html5/thumbnails/4.jpg)
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 5: ITR3 lecture 7: more introduction to UNIX Thomas Krichel 2002-11-05.](https://reader036.fdocuments.net/reader036/viewer/2022082917/5514d9ad55034693478b53df/html5/thumbnails/5.jpg)
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 6: ITR3 lecture 7: more introduction to UNIX Thomas Krichel 2002-11-05.](https://reader036.fdocuments.net/reader036/viewer/2022082917/5514d9ad55034693478b53df/html5/thumbnails/6.jpg)
stdin, stdout, stderr
• Stand for standard input, output and error,• Normally keyboard, screen, screen• Can redirect• > file redirect output to a file• >> file redirect output to append a file• < file use input from file • 2> file redirect error to a file• 2>> file redirect error to append a file
![Page 7: ITR3 lecture 7: more introduction to UNIX Thomas Krichel 2002-11-05.](https://reader036.fdocuments.net/reader036/viewer/2022082917/5514d9ad55034693478b53df/html5/thumbnails/7.jpg)
pipe
• The vertical bar takes the output and makes it the input of another program.
• Example: how many files do I have?ls | grep –c ^
• What is the most recent files?ls –t | tail -1
![Page 8: ITR3 lecture 7: more introduction to UNIX Thomas Krichel 2002-11-05.](https://reader036.fdocuments.net/reader036/viewer/2022082917/5514d9ad55034693478b53df/html5/thumbnails/8.jpg)
Machine access
• Console access
• Network access– Need to know the IP number– That number may be changed by the LIU
network. – Run a scheduled job to report the number to
wotan, which itself has a static number and name.
![Page 9: ITR3 lecture 7: more introduction to UNIX Thomas Krichel 2002-11-05.](https://reader036.fdocuments.net/reader036/viewer/2022082917/5514d9ad55034693478b53df/html5/thumbnails/9.jpg)
cron
• cron is a daemon that runs scheduled jobs.
• crontab file set a file file to be the schedule. Changing the file does not change the crontab.
• The schedule file has a list of times and a list of command that are being executed.
• crontab –l lists the crontab• crontab –r removes it.
![Page 10: ITR3 lecture 7: more introduction to UNIX Thomas Krichel 2002-11-05.](https://reader036.fdocuments.net/reader036/viewer/2022082917/5514d9ad55034693478b53df/html5/thumbnails/10.jpg)
Contab structure
• “Minute” “hour” “day of month” “month” “day of the week”
• Day of the week goes 0 to 6, 0 is Sunday.
• * means any
• Followed by the command, for example
• 46 5 * * * rsync --delete -qa /home/krichel [email protected]:rsync/arcano/home > /dev/null 2> /dev/null
![Page 11: ITR3 lecture 7: more introduction to UNIX Thomas Krichel 2002-11-05.](https://reader036.fdocuments.net/reader036/viewer/2022082917/5514d9ad55034693478b53df/html5/thumbnails/11.jpg)
Internet configuration• You request an IP address using dhcp from
your provider with dhclient. There are many ways in which the client can be configured.
• You get a report of the configuration of the Internet access with /sbin/ifconfig.
• You need to put this in a file – /sbin/ifconfig > host.if
where “host” is your host name• Copy this file to wotan account
– scp host.if @wotan.liu.edu
• Put this is the crontab, every hour, say.
![Page 12: ITR3 lecture 7: more introduction to UNIX Thomas Krichel 2002-11-05.](https://reader036.fdocuments.net/reader036/viewer/2022082917/5514d9ad55034693478b53df/html5/thumbnails/12.jpg)
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 13: ITR3 lecture 7: more introduction to UNIX Thomas Krichel 2002-11-05.](https://reader036.fdocuments.net/reader036/viewer/2022082917/5514d9ad55034693478b53df/html5/thumbnails/13.jpg)
naming
• DNS attaches names to machines on the Internet. This allows us to keep names
• Names are used in collections called domains. Domains must be registered.
• Thomas has a DNS server for the domain openlib.org
• Thomas can write an application that will take the different *.if files, and collect them on fafner, and create a file will provide with a zone that will name in the itr3.openlib.org domain, as host.itr3.openlib.org
![Page 14: ITR3 lecture 7: more introduction to UNIX Thomas Krichel 2002-11-05.](https://reader036.fdocuments.net/reader036/viewer/2022082917/5514d9ad55034693478b53df/html5/thumbnails/14.jpg)
Name calling
• Not officially allowed. The University only wants .liu.edu names for machines in the University network. And of course they own the domain and operate the server.
• Nevertheless, I could demonstrate how this could work.
• Probably next week .
![Page 15: ITR3 lecture 7: more introduction to UNIX Thomas Krichel 2002-11-05.](https://reader036.fdocuments.net/reader036/viewer/2022082917/5514d9ad55034693478b53df/html5/thumbnails/15.jpg)
dselect
• Is the main tool to add and remove software.
• You have to do this as “root”.• Set the distribution to be the “testing”.• Set the apt method for getting package
files. • You can also add non-official sources:• http://www.braincells.com/debian sid/ for
pine for example
![Page 16: ITR3 lecture 7: more introduction to UNIX Thomas Krichel 2002-11-05.](https://reader036.fdocuments.net/reader036/viewer/2022082917/5514d9ad55034693478b53df/html5/thumbnails/16.jpg)
Package conflicts
• When you install packages that require others that are not there yet, or when you remove packages that others depend on, the system will prompt you.
• Typing “R” at this stage will get you back.• It pays to look at the keystrokes that you
can do in dselect and learn the most important ones/ search \ repeat search + select -
deselect
![Page 17: ITR3 lecture 7: more introduction to UNIX Thomas Krichel 2002-11-05.](https://reader036.fdocuments.net/reader036/viewer/2022082917/5514d9ad55034693478b53df/html5/thumbnails/17.jpg)
Dselect
• Update updates the package list, gets you the latest version of all packages.
• Install does the installation
• Configure seems no longer being used
• Remove seems no longer being used, removals are done by Install
![Page 18: ITR3 lecture 7: more introduction to UNIX Thomas Krichel 2002-11-05.](https://reader036.fdocuments.net/reader036/viewer/2022082917/5514d9ad55034693478b53df/html5/thumbnails/18.jpg)
http://openlib.org/home/krichel
Thank you for your attention!